An installed flask in a virtual file has not yet completed "command not found"

Installed virtualenv, activated it, checked, checked, and yet, when I try to run the script or see if it recognizes, I cannot get the command.

(project) gabriel@debian :~/project$ pip list Flask (0.10.1) itsdangerous (0.24) Jinja2 (2.7.3) MarkupSafe (0.23) pip (1.5.6) setuptools (5.5.1) Werkzeug (0.10.4) (project) gabriel@debian :~/project$ flask -bash: flask: command not found (project) gabriel@debian :~/project$ Flask -bash: Flask: command not found (project) gabriel@debian :~/project$ </3 

Also tried:

 (project) gabriel@debian :~/project$ python -m flask pi.py /home/gabriel/project/bin/python: No module named flask.__main__; 'flask' is a package and cannot be directly executed (project) gabriel@debian :~/project$ 
+5
source share
4 answers

The 0.10 flag has no flask command; it was added in 0.11. If pi.py has a smartphone to run your application, for example, if it uses Flask-Script, the command you are looking for is:

 $ python pi.py 

You can install Flask-CLI to get the flask command at 0.10 if you cannot upgrade to 0.11.

+15
source

I encountered this problem while working with the tutorial for version 0.12, so for those who found this thread, faced with this problem with a later version, I was able to start the server using:

 $ python -m flask run 
+4
source

I used Flask 0.10.1 and to check if it should be installed, you must activate virtualenv and then type:

 $ python >>> from flask import Flask 

if it runs smoothly, you have it. To run the application you can use

 app = Flask(__name__) app.run(debug=True) 

or use flask_script:

 from flask_script import Manager manager = Manager(app) manager.run 

Hope this helps you

0
source

I am using version 0.12.2 and got the same problem. Here is my solution:

python -m flask run FLASK_APP=/path/to/filename.py

0
source

All Articles