# 创建venv环境 [five@nagios-server hello_flask]$ virtualenv venv New python executable in /home/five/hello_flask/venv/bin/python Installing setuptools, pip, wheel...done. [five@nagios-server hello_flask]$ ll total 0 drwxrwxr-x. 5 five five 77 Apr 16 19:21 venv [five@nagios-server hello_flask]$ ll venv/ total 8 drwxrwxr-x. 2 five five 4096 Apr 16 19:21 bin drwxrwxr-x. 2 five five 22 Apr 16 19:20 include drwxrwxr-x. 3 five five 22 Apr 16 19:20 lib lrwxrwxrwx. 1 five five 3 Apr 16 19:20 lib64 -> lib -rw-rw-r--. 1 five five 60 Apr 16 19:21 pip-selfcheck.json [five@nagios-server hello_flask]$ ll venv/bin/ total 52 -rw-rw-r--. 1 five five 2086 Apr 16 19:21 activate -rw-rw-r--. 1 five five 1028 Apr 16 19:21 activate.csh -rw-rw-r--. 1 five five 2226 Apr 16 19:21 activate.fish -rw-rw-r--. 1 five five 1137 Apr 16 19:21 activate_this.py -rwxrwxr-x. 1 five five 255 Apr 16 19:20 easy_install -rwxrwxr-x. 1 five five 255 Apr 16 19:20 easy_install-2.7 -rwxrwxr-x. 1 five five 227 Apr 16 19:20 pip -rwxrwxr-x. 1 five five 227 Apr 16 19:20 pip2 -rwxrwxr-x. 1 five five 227 Apr 16 19:20 pip2.7 -rwxrwxr-x. 1 five five 7136 Apr 16 19:20 python lrwxrwxrwx. 1 five five 6 Apr 16 19:20 python2 -> python lrwxrwxrwx. 1 five five 6 Apr 16 19:20 python2.7 -> python -rwxrwxr-x. 1 five five 2345 Apr 16 19:21 python-config -rwxrwxr-x. 1 five five 234 Apr 16 19:20 wheel # 激活venv环境, 通过which来确认以切换至venv环境 [five@nagios-server hello_flask]$ . venv/bin/activate 或 source venv/bin/activate (venv) [five@nagios-server hello_flask]$ which python ~/hello_flask/venv/bin/python
About the First Parameter The idea of the first parameter is to give Flask an idea what belongs to your application. This name is used to find resources on the file system, can be used by extensions to improve debugging information and a lot more.
So it’s important what you provide there. If you are using a single module, name is always the correct value. If you however are using a package, it’s usually recommended to hardcode the name of your package there.