Issue
I am very new to flask trying to run my flask app from conda virtual environment, the steps I've taken are as follow. In Anaconda Prompt (base), I run:
conda activate P:\muPythonEnv
then I navigate where the app.py is:
cd P:\Documents\Python Scripts\newPythonEnv\Reine\reactFlaskTutorial
After I do
set FLASK_APP = app
set FLASK_ENV = development
flask run
for which I get the following error:
* Serving Flask app 'app' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Usage: flask run [OPTIONS]
Error: While importing 'app', an ImportError was raised.
I wonder what am I doing wrong here? is it not possible to run flask in conda vm? also despite I set the end to development I still get a Warning, why is that so?
Solution
The problem you are facing has nothing to do with conda
, as we can see in the logs, flask
package is found.
The problem is related to a module you use in your code that is not available in the conda environment. You need to check imports in your code and check if the corresponding packages are available in your conda environment by running conda list
.
The warning you have is to tell you that running the flask embedded web server is not a good option for production see here for more information and deployment options.
Answered By - Romain
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.