Installation Flask error resolution and PIP Trusted-host parameters
Install flask Error:
Flask_install_error
This is based on the tutorial https://dormousehole.readthedocs.org/en/latest/installation.html#virtualenv step-by-step operation, VIRTUALENV virtual environment is also installed, But Pip install flask is not successful, nor is it possible to swap mirrors.
But strangely, exiting the VIRTUALENV virtual environment using mirrored installation flask is OK, but this is not the desired result.
The original screenshot of the yellow hint has been said very clearly, with –trusted-host pypi.douban.com’
(venv) D:\flask-website>pip Install flask-i http://pypi.douban.com/simple/--trusted-host pypi.douban.com
That's OK.
Similarly, other libraries that need to install flask dependencies are also installed using the agreed PIP command in the VIRTUALENV environment, such as installing the SQLAlchemy module:
(venv) D:\flask-website>pip Install sqlalchemy-i http://pypi.douban.com/simple--trusted-host pypi.douban.com
Again, such as Python-openid module installation:
(venv) D:\flask-website>pip Install python-openid-i http://pypi.douban.com/simple--trusted-host pypi.douban.com
All of these need to be installed separately in the VIRTUALENV environment, not the global installation
Flask-website:no MODULE NAMED flask. EXT. Openid
In the local Run Flask official website Program (github:https://github.com/mitsuhiko/flask-website), install good requirements.txt in the module, run the error: No module Named Flask.ext.openid.
Here you need to make the following modifications to the __init__.py file in the Flask_website directory:
# from Flask_openid.ext.openid import OpenID
From Flask_openid import OpenID
Then run run.py to launch the Web site, access 127.0.0.1:5000 through the browser successfully!
(venv) D:\flask-website>python run.py
* Restarting with stat
* Debugger is active!
* Debugger pin code:328-241-599
127.0.0.1--[09/dec/2015 18:18:25] "get/http/1.1" 200-
127.0.0.1--[09/dec/2015 18:18:25] "Get/static/style.css http/1.1" 304-
Local Environment version:
python:2.7.9
flask:0.10.1
Flask Install: A TRUE sslcontext OBJECT is not AVAILABLE
If the installation flask this error: Insecureplatformwarning:a True Sslcontext object is not available. This prevents URLLIB3 from configuring SSL
Appropriately and may cause certain SSL connections to fail. For more information, https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
And if your Python version is a 2.7.9 version, you'll need to upgrade the Python version, or Pip Install-u requests[security], because the SSL environment provided by Python before 2.7.9 is not safe enough to improve.
The first flask program starts with Hello World, first installing the Flask environment and framework, and creating a new hello.py in the directory as follows:
Python
From flask import Flask
App = Flask (__name__)
@app. Route ('/')
Def hello_world ():
Return ' Hello world! '
if __name__ = = ' __main__ ':
App.run ()
Then enter at the terminal or command line:
Python hello.py
You can see the command line output section:
(venv) D:\firstflask>python hello.py
* Running on http://127.0.0.1:5000/(press CTRL + C to quit)
127.0.0.1 – – [08/dec/2015 19:33:08] “ get/http/1.1” –
127.0.0.1 – – [08/dec/2015 19:33:08] “ Get/favicon.ico http/1.1” 404 –
127.0.0.1 – – [08/dec/2015 19:33:08] “ Get/favicon.ico http/1.1” 404 –
When you visit http://127.0.0.1:5000/in your browser, you can see that the browser shows Hello world.