-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't require FLASK_APP to have .py extension #2383
Don't require FLASK_APP to have .py extension #2383
Conversation
b851684
to
0ccb5d3
Compare
Thanks! This is sort of the opposite direction of what I was imagining though. For example, a package that's not installed still requires |
f04bf67
to
fb437ce
Compare
Ah, I see. I updated the method to append the sys path if the referenced |
@@ -82,6 +82,8 @@ Major release, unreleased | |||
- Fix incorrect JSON encoding of aware, non-UTC datetimes. (`#2374`_) | |||
- Template auto reloading will honor the ``run`` command's ``debug`` flag even | |||
if ``app.jinja_env`` was already accessed. (`#2373`_) | |||
- The ``flask`` command no longer requires that the ``FLASK_APP`` environment | |||
variable have a ``.py`` extension. (`#2383`_) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
flask/cli.py
Outdated
for path in [app, app + '.py']: | ||
if os.path.isfile(path): | ||
return prepare_exec_for_file(path) | ||
if os.path.isdir(app): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
fb437ce
to
3c049ad
Compare
A friend pointed out that |
@davidism wouldn't it hinge on os.path.isfile() behavior? In that case, don't see how |
Because the current directory is already inserted into |
Thanks for working on this. I ended up fixing this in #2414 by dropping the |
Addresses #2377. The simplest way that I found to do this was to just patch the
find_default_import_path
method to check if there's a file with the.py
extension.Worked in all of my testing. 🙂