简体   繁体   中英

Running flask app in conda virtual environment

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM