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
Importing from PWD using python -m
fails in development environment
#2817
Comments
Close it since it is not a bug of Flask. It seems a misunderstanding of Python PATH. I don't know where you put your |
With all due respect, it seems like you haven't understood the issue. I do understand how PATH works, and I did say where foo.py is located. I also said that starting the Flask server this way works for the production environment, but not for the development environment. So clearly, this is related to Flask rather than be a general issue of Python imports. But to be absolutely clear, if you don't have the call to I would be grateful if you could look at this issue again and try to fully understand what is reported about the behavior of the Flask development server. |
I'm sorry, but I don't fully understand your |
It is a werkzeug reloader issue. Maybe related to pallets/werkzeug#461 |
Thanks! Trying to understand exactly what that issue and #1246 imply for this. |
Expected Behavior
We have a Flask app defined in a file which sits inside a folder, say
app/run.py
:The file imports from the top-level directory, in this case
foo.py
The empty file
__init__.py
exists in the directoryapp
.Using the default environment (production), we can run the Flask app by invoking the module from the top-level directory, using
-m
The
foo
module is imported correctly and the app runs.Actual Behavior
If we try to use the development environment, setting the
FLASK_ENV
variable, it fails.Environment
Python version:
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
package versions:
click==6.7
Flask==1.0.2
itsdangerous==0.24
Jinja2==2.10
MarkupSafe==1.0
Werkzeug==0.14.1
The text was updated successfully, but these errors were encountered: