Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flask.cli.NoAppException: Application crashing

Tags:

python

flask

My Flask Application is crashing when I'm trying to access it.

This is similar error to this or this. However, my set-up seems correct.

flask.cli.NoAppException: The file/path provided (server) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py

My environment variable correctly set.

export FLASK_APP=server.py
export FLASK_DEBUG=1

My server file is server.py, and I don't have any __init__.py in the directory.

I don't recall having change anything special in the code. Where does the bug could come from?

like image 833
fast_cen Avatar asked Feb 01 '17 12:02

fast_cen


2 Answers

This error may be a sign that an import is not found. To see which import is missing, try to run your server.py file with the python interpreter:

    python yourapp.py

Example of output :

    Traceback (most recent call last):
        File "yourapp.py", line 4, in <module>
         from flask_httpauth import HTTPBasicAuth
    ImportError: No module named flask_httpauth

Source (and other leads)

like image 163
Francois Avatar answered Oct 07 '22 19:10

Francois


The issue was that some package were missing or corrupted.

I reinstalled everything with pip3 install -r requirements.txt --ignore-installed and now it works fine.

like image 43
fast_cen Avatar answered Oct 07 '22 19:10

fast_cen