-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
"[Errno 2] No such file or directory" on flask run with FLASK_DEBUG=1 #1829
Comments
I faced the same error. However it works when I run it as a module: $ python -m flask run |
This might fall under the same issue as #1847. |
There is a question on stackoverflow for this issue: http://stackoverflow.com/questions/37650208/flask-cant-find-app-file |
I'm having the same problem on Windows Server with Flask 0.11.1 except when I try
I get: ImportError: cannot import name Flask Currently I can only make it work with FLASK_DEBUG=0 I'd be happy to provide any other details... |
This is caused as python is looking for a script named flask, but on windows it is called flask.exe. As a temporary fix you can copy and paste flask.exe, and just rename it 'flask' |
Good call @TomIsPrettyCoool. |
I am unable to currently replicate the bug as it uses stat instead of the windowsapi reloader.
|
It seems it doesn't happen with the new updated version of werkzeug since it uses the stat reloader if you don't have the watchdog package installed. |
If you run into this you can temporarily use |
I am trying to replicate the bug to see if if implementing the batch file fix was feasible. However, I am having difficulty trying to get the error to come up. Any suggestions? |
I saw it happen on Python 3 in a virtualenv. Not sure if that's the key. |
It could be. Currently running Python 3.5.2 and also an updated werkzeug. |
@mitsuhiko What would you propose to follow up on next? Since the new werkzeug changed the reloader. |
@ferbecab03 fix it in werkzeug. Btw I wonder if the issue also happens if you run it as "flask.exe" instead of "flask" from the command line. |
I can't help with this - no longer using a Windows machine... |
This should be fixed on the Werkzeug 0.11 branch. |
Is the issue then closed because of the new update? |
I need to release it still. Was kinda hoping someone would test this on windows since I'm not with a windows machine currently. |
@ALL I have noticed that is is sufficient to use --reload to reproduce the bug as well @mitsuhiko - the fix needed some tweaking an might need something more (or there could be an unrelated issue) Firstly, I noticed that the fix checked for 'NT', but on my system at least, os.name returns 'nt', I've updated this to handle either case. After more digging I notice that your Here is a working fix: HOWEVER...
This seems to be a separate outstanding issue with the watchdog package. Watchdog used when installed or else werkzeug falls back stats. gorakhargosh/watchdog#296 |
This is now fixed in Werkzeug 0.11.13. Sorry it took a while but I did not have a windows PC with me until now. |
I am still getting the same behavior, when trying to run a packaged application, without installing and also using the FLASK_DEBUG=1 ... 😕 Inside a virtualenv using Ubuntu 16.04.3 LTS pip list output:
Then but
|
I too am getting the same problem.
The fix suggested worked but it took me along time to find the suggestion.
My
|
What is the equivalent of 'python -m flask run' if I am importing the python flask library and using
Currently Im getting the same error |
If you want to run the CLI programatically, it would be: from flask.cli import main
main(["--port", "8080"]) Your example suggests you're trying to use the development server in production (binding to the public with 0.0.0.0). Do not do this, use production WSGI and HTTP servers, see the deployment docs. |
No Im trying to run the server locally and have the server update with changes every time I save a file during development which is why Im trying to use debug=True which is not working... I dont think your answer addresses that issue... |
Do |
And don't put `app.run` in your source file.
…On Fri, Oct 18, 2019 at 1:34 PM David Lord ***@***.***> wrote:
Do export FLASK_ENV=development before flask run. This is documented
here: https://flask.palletsprojects.com/en/1.1.x/cli/#environments
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1829?email_source=notifications&email_token=ABORVLLECDJDURP7SANATHDQPHXSRA5CNFSM4CFFNJK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBVIHHY#issuecomment-543851423>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABORVLJ4K4VEVOLEJIPBPBTQPHXSRANCNFSM4CFFNJKQ>
.
|
Im using nginx for the web server. But when you say "use production WSGI" what do you mean because I see in the documentation it says "Just remember that your Flask application object is the actual WSGI application." So what more do I need to do in terms of WSGI? |
ok I think I understand now after reading this article: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04 |
in my case due to carriage return, i need to convert \r\n to \n (LF) and it works |
I get the following
[Errno 2] No such file or directory
with flask 0.11 & werkzeug 0.11.10 on Windows 7 64bit with Python 3.5 but only whenFLASK_DEBUG=1
.hello_flask.py
is the minimal app from the docs.The text was updated successfully, but these errors were encountered: