Commit graph

79 commits

Author SHA1 Message Date
Armin Ronacher
2ef2000a39
Enable threads by default for the dev server (#2529)
Enable threads by default for dev server
2017-11-25 00:17:09 +01:00
Roy Crihfield
e3c853e604 Fix typo in cli.py (#2502) 2017-10-24 08:10:12 +02:00
David Lord
9bc329c0c9
rewrite cli docs
reflects the current FLASK_APP detection
2017-10-10 11:10:20 -07:00
David Lord
5436dddf64
rewrite cli errors
consistent order for arguments to load functions
refactor find_app_by_string to flow better
more cli loader tests
2017-10-10 07:04:53 -07:00
David Lord
491d331e6e
load env vars using python-dotenv 2017-07-16 13:37:51 -07:00
David Lord
fb845b9032
allow local packages in FLASK_APP
don't require .py extension in FLASK_APP
add tests for nested package loading
parametrize cli loading tests
2017-07-14 19:49:05 -07:00
Miguel Grinberg
4f30cb7c57
fix variable substitution in error message 2017-06-27 07:27:10 -07:00
David Lord
448368e226
style cleanup
[ci skip]
2017-06-16 06:59:37 -07:00
Miguel Grinberg
7c40aa9e50
Import app from wsgi.py or app.py if FLASK_APP is not defined
Fixes #2376
2017-06-15 11:27:50 -07:00
David Lord
4fc48200a5
reconfigure the app from run command and method
extract templates_auto_reload to property
continues #1910
closes #1907
2017-06-14 12:08:25 -07:00
David Lord
12c45f06a5
remove unused import 2017-06-04 12:38:10 -07:00
David Lord
fa7e8d6073
be smarter about adding ".cli" to reloader command
python -m flask.cli raises an import warning on > 2.6
it's only needed on 2.6, "flask" works otherwise
closes #2357
2017-06-04 12:26:21 -07:00
Junior Báez
4f689c41d9 #2341: Accept default argument value when args lenght equal 1 2017-05-27 18:02:18 -04:00
Kenneth Reitz
7c0b36f146 cleanup #2326 2017-05-26 09:16:45 -04:00
Hendrik Makait
48c2925664 Factor in code review comments and refactor functions to be more naturally split. 2017-05-25 11:28:20 -07:00
Hendrik Makait
7a1a594b26 Factor out call_factory_from_regex function 2017-05-25 10:11:42 -07:00
Hendrik Makait
7106fb6357 Handle app factory with arguments in FLASK_APP 2017-05-25 10:11:42 -07:00
David Lord
38df3df735
shorten cli factory name
[ci skip]
2017-05-23 16:19:41 -07:00
Hendrik Makait
ae41df9a77 Check if app factory takes script_info argument and call it with(out) script_info as an argument depending on that 2017-05-23 13:48:42 -07:00
David Lord
01ddf54b87
adjust for loop style 2017-05-22 16:12:23 -07:00
David Lord
7ecdbcfa2b
show error if multiple Flask instances are detected
add changelog
2017-05-22 15:48:08 -07:00
Hendrik Makait
b4eb6534d5 Remove unnecessary checks and reformat NoAppException messages 2017-05-22 14:26:00 -07:00
Hendrik Makait
ced719ea18 Auto-detect create_app and make_app factory functions 2017-05-22 12:30:18 -07:00
David Lord
7ad79583b9
add sort by match order
sort by endpoint by default
combine sort flags
sort methods
ignore HEAD and OPTIONS methods by default
rearrange columns
use format to build row format string
rework tests
add changelog
2017-04-26 10:26:59 -07:00
David Lord
717e45ab15
Merge branch 'master' into routes-command 2017-04-25 13:13:10 -07:00
Ed Brannin
7a7a163ff1 shorten output when ImportError due to app bug.
Before:
```
C:\dev\tmp>py -2 -m flask run
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "c:\dev\sourcetree\flask\flask\__main__.py", line 15, in <module>
    main(as_module=True)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 523, in main
    cli.main(args=args, prog_name=name)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 383, in main
    return AppGroup.main(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "C:\Python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "C:\Python27\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "C:\Python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 433, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 153, in __init__
    self._load_unlocked()
  File "c:\dev\sourcetree\flask\flask\cli.py", line 177, in _load_unlocked
    self._app = rv = self.loader()
  File "c:\dev\sourcetree\flask\flask\cli.py", line 238, in load_app
    rv = locate_app(self.app_import_path)
  File "c:\dev\sourcetree\flask\flask\cli.py", line 91, in locate_app
    __import__(module)
  File "C:\dev\tmp\error.py", line 1, in <module>
    import whatisthisidonteven
ImportError: No module named whatisthisidonteven
```

After:
```
C:\dev\tmp>py -2 -m flask run
Usage: python -m flask run [OPTIONS]

Error: There was an error trying to import the app (error):
Traceback (most recent call last):
  File "c:\dev\sourcetree\flask\flask\cli.py", line 91, in locate_app
    __import__(module)
  File "C:\dev\tmp\error.py", line 1, in <module>
    import whatisthisidonteven
ImportError: No module named whatisthisidonteven```
2017-03-21 15:22:15 -04:00
Sven-Hendrik Haase
ad42d88fb2 Remove useless pass 2017-03-16 14:42:16 +01:00
Sven-Hendrik Haase
5b7fd9ad88 Print a stacktrace on CLI error (closes #2208) 2017-03-16 14:37:58 +01:00
Armin Ronacher
c9b33d0e86 Convert Flask.run into a noop when run from the CLI 2017-01-29 12:26:52 +01:00
Paul Brown
0832e77b14 prevent NoAppException when ImportError occurs within imported module 2016-12-30 22:45:53 +01:00
Clenimar Filemon
77af942b98 Capitalize occurrences of 'flask' (#2067) 2016-11-01 18:52:32 -07:00
Michael Recachinas
49ecc88d99 Remove -a/--app from Quickstart documentation (#2046)
* Remove `-a/--app` from Quickstart documentation

As mentioned in #2009, simplifying the CLI saw the removal of the `-a/--app` flag. Therefore, the only way to specify the module to import is by setting `FLASK_APP`.

* Remove misleading `either` from CLI help

The CLI help details how to run the application, but still uses the phrasing "either through the `FLASK_APP`...". This likely is an artifact from when `-a/--app` was still present in the CLI.
2016-10-01 18:45:22 +02:00
Markus Unterwaditzer
c4ec6954e5 Don't passthrough_errors unless instructed. (#2006)
Fix #2005

Revert #1679 and #1996
2016-09-06 22:32:34 +02:00
Markus Unterwaditzer
098ea0c8ca Only passthrough_errors if PROPAGATE_EXCEPTIONS
See pallets/werkzeug#954
2016-08-27 14:38:13 +02:00
Nate Prewitt
0f1cf50f97 adding in try around __import__ to catch invalid files/paths (#1950) 2016-08-12 15:12:00 +02:00
David Lord
1928f28a68 clean up code formatting in some docs
fix warnings while building docs
2016-06-26 13:03:29 -07:00
Kiss György
b8e826c16b Added tests, fixed some minor alignment problems. 2016-06-25 13:22:18 +02:00
Kiss György
1647179511 Added routes command, which shows all the endpoints registered for the app.
Orderable by rules, endpoints and methods. Shows up in the builtin command list.
2016-06-25 12:15:14 +02:00
David Lord
0e4607000d re-add passthrough_errors to cli runner (#1928)
This got dropped during the cli simplification.  Re: #1679
2016-06-23 13:00:45 -07:00
jphilipsen05
fe5f714026 fixed unmatched elif (#1872) 2016-06-03 18:41:10 +02:00
RamiC
6b28ceba83 Use the whole sys.version string 2016-06-02 13:55:00 +03:00
RamiC
6bee3e4995 Add a --version switch to flask cli
re #1828
2016-06-02 13:35:16 +03:00
Yoav Ram
a725836523 Update help to > set FLASK_APP=hello.py (#1830)
When running `flask --help`, the printed string contains this:
>   Example usage:
>
>   set FLASK_APP=hello
>    set FLASK_DEBUG=1
>    flask run

but it actually only works with `set FLASK_APP=hello.py` so the help should be changed.

This is true on my Windows 7 Python 3.5 flask 0.11 setup.
2016-05-30 23:20:35 +02:00
Armin Ronacher
9594876c1f Added plugin support to the cli 2016-05-26 21:29:01 +02:00
Armin Ronacher
a7d829c618 Update docs to the new CLI patterns 2016-05-26 20:45:50 +02:00
Armin Ronacher
523e271183 Implemented simplified CLI interface 2016-05-26 20:07:52 +02:00
Miguel Grinberg
952a6c8989 Werkzeug should not block propagated exceptions from Flask 2016-01-02 14:18:36 -08:00
GunWoo Choi
c65b32ba1d Update title of docstring in flask.cli 2015-06-12 13:40:53 +09:00
Parkayun
33534bb4a9 Happy New Year 2015 2015-01-02 11:35:00 +09:00
Armin Ronacher
d931216ade Hide a few traceback frames from the cli interface. 2014-12-27 12:25:03 +01:00