Commit graph

61 commits

Author SHA1 Message Date
David Lord
8b9128ee06 cleaner message when CLI can't load app
When loading the app fails for the --help command, only the error
message is shown, then the help text. The full traceback is shown for
other exceptions. Also show the message when loading fails while
getting a command, instead of only "command not found". The error
message goes to stderr to match other error behavior, and is in red
with an extra newline to make it more obvious next to the help text.

Also fixes an issue with the test_apps fixture that caused an imported
app to still be importable after the test was over and the path was
reset. Now the module cache is reset as well.
2020-07-30 18:36:55 -07:00
David Lord
ee7d80bb55 Merge pull request #3699 from MartinThoma/style
remove unnecessary docstrings from tests
2020-07-28 19:44:23 -07:00
Martin Thoma
090c9e9a81 DOC: Remove unnecessary docstrings 2020-07-26 15:47:12 +02:00
Grey Li
62c582e19b Stop change CWD to .env/.flaskenv location 2020-07-05 09:37:03 +08:00
David Lord
042754ba4a use ast to parse FLASK_APP
enables keyword arguments to factory functions
2020-04-07 17:54:51 -07:00
David Lord
f2a8087cf5 deprecate passing script_info to factory 2020-04-07 15:54:36 -07:00
David Lord
296ef35943 remove unused module docstrings 2020-04-04 12:28:08 -07:00
David Lord
f5038c4c39 f-strings everywhere 2020-04-04 12:10:00 -07:00
David Lord
67bb43b738 apply pyupgrade 2020-04-04 12:10:00 -07:00
David Lord
1e5e3aae8a remove more compat code 2020-04-04 12:10:00 -07:00
David Lord
d1ffe44185 cli checks for cryptography library 2020-02-10 17:34:19 -08:00
David Lord
ff0c92a1c7 Merge branch '1.0.x' 2019-06-23 16:57:52 -07:00
David Lord
e066e9f9e3 standardize license and copyright 2019-06-22 13:09:09 -07:00
David Lord
e66fe2e8e7 apply reorder-python-imports pre-commit config 2019-06-01 09:07:20 -07:00
Jon S. Stumpf
4dc9c68d19 address flake8 issues 2019-06-01 06:31:35 -07:00
cslecrone
f7d690e474 don't require ssl module for flask cli 2019-05-31 17:27:52 -04:00
Daniel Pope
ecdb6e98ae Do not register empty CLI groups from Blueprint
(Fixes #3224)
2019-05-31 16:49:01 +01:00
Daniel Pope
ad9807891d Fix style issues on master using Black 2019-05-31 11:57:28 +01:00
Anthony Plunkett
cc2580af09 Add Blueprint level cli command registration
Implements #1357.
Adds ability to register click cli commands onto blueprint.
2019-05-24 14:43:29 -07:00
Adarsh Sharma
c884f6ec19 Fix #2937: Ensure the consistency in load_dotenv's return type 2019-05-19 11:58:39 -07:00
David Baumgold
85ce588b3b Reformat with black
https://github.com/python/black
2019-05-06 16:28:58 -04:00
David Lord
857460b75a Merge branch '1.0-maintenance' 2019-01-06 16:33:17 -08:00
David Lord
934c6ab22e clean up flask --version code 2019-01-06 16:24:05 -08:00
David Lord
ca27661d8a Merge branch '1.0-maintenance' 2019-01-05 15:12:17 -08:00
garenchan
9da281c04c ignore colon with slash when split app_import_path
Flask currently supports importing app through a combination of module
path and app variable name, such as '/usr/app.py:my_app'. When the
module path contains a colon, it will conflict with this import way and
a `flask.cli.NoAppException` will be raised.

A file path on a Windows system may contain a colon followed by a slash.
So we solved this problem on Windows by ignoring the colon followed by a
slash when we split app_import_path.

Fix issue #2961.
2018-10-24 23:47:41 +08:00
ThiefMaster
c93c5e750e Merge branch '1.0-maintenance' 2018-06-14 13:31:40 +02:00
ThiefMaster
fbaeb1fc99 Add option to not overwrite debug flag in cli
This is mainly intended for custom CLIs that may load a config file
which already sets the debug flag and does not make use of the `FLASK_*`
env vars at all.
2018-06-14 13:25:05 +02:00
Grey Li
aaa7e2db92 Add test for routes command when no routes registered 2018-05-31 11:43:51 +08:00
Briehan Lombaard
51f4340127 SSLContext was added in Python 2.7.9 2018-05-17 06:18:42 -07:00
David Lord
eb52ca4625 rename to FLASK_SKIP_DOTENV, add docs, test 2018-04-29 14:20:17 -07:00
David Lord
aa4db37a7f revert copyright year to project start
add copyright header to files
2018-02-08 12:43:30 -08:00
David Lord
f23e388b81 Merge pull request #2530 from pallets/feature/factory-detection
Improved bad factory error handling
2018-01-28 11:27:07 -08:00
David Lord
b0e8e7d485 add HTTPS support for flask run command 2018-01-23 10:03:53 -08:00
David Lord
8dfb664336 reset standard os env after each test 2018-01-10 13:53:45 -08:00
Armin Ronacher
28e9f419f9 Improved bad factory error handling 2017-11-25 00:05:57 +01:00
David Lord
042948a4ad 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
f0101de17b load env vars using python-dotenv 2017-07-16 13:37:51 -07:00
David Lord
b4505e53a5 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
David Lord
b96a1c0f99 style cleanup
[ci skip]
2017-06-16 06:59:37 -07:00
Miguel Grinberg
ce78369f37 Import app from wsgi.py or app.py if FLASK_APP is not defined
Fixes #2376
2017-06-15 11:27:50 -07:00
Hendrik Makait
a115c6b025 Factor in code review comments and refactor functions to be more naturally split. 2017-05-25 11:28:20 -07:00
Hendrik Makait
e5dff166de Handle app factory with arguments in FLASK_APP 2017-05-25 10:11:42 -07:00
Christian Stade-Schuldt
55b92efab4 More DRYing up the test suite (#2325) 2017-05-24 17:27:36 -07:00
Hendrik Makait
3d220155b9 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
Hendrik Makait
91633c21ec Auto-detect create_app and make_app factory functions 2017-05-22 12:30:18 -07:00
David Lord
c279a827cc 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
57515e1887 Merge branch 'master' into routes-command 2017-04-25 13:13:10 -07:00
Ed Brannin
9c40039620 Fix CLI test for ImportError -> NoAppException 2017-03-21 16:17:09 -04:00
Sven-Hendrik Haase
edd6e3154d Add test to showcase that printing a traceback works 2017-03-16 20:56:12 +01:00
Paul Brown
74a0eee5a1 prevent NoAppException when ImportError occurs within imported module 2016-12-30 22:45:53 +01:00