AttributeError: 'NoneType' object has no attribute 'SSLContext' running flask script in PyCharm 2018.3.7 on Win10 AttributeError: 'NoneType' object has no attribute 'SSLContext' running flask script in PyCharm 2018.3.7 on Win10 flask flask

AttributeError: 'NoneType' object has no attribute 'SSLContext' running flask script in PyCharm 2018.3.7 on Win10


FLASK_APP should have your flask module.

flask quickstart would be helpful.

you need to tell your terminal the application to work with by exporting the FLASK_APP environment variable

BTW, pycharm provides easy way to create flask app. This link also helps you.

Here is my simple example.

$ cat hello.py from flask import Flaskapp = Flask(__name__)@app.route("/")def hello():    return "hello world"$ env FLASK_APP=hello.py  flask run * Serving Flask app "hello.py" * 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 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 127.0.0.1 - - [12/Apr/2020 12:13:04] "GET / HTTP/1.1" 200 -


You must run it from the anaconda prompt in the right environment.

(data-class) C:\Users\Faramarz>cd /d D:\...\surfs_up(data-class) D:\...\surfs_up>set FLASK_APP=app.py(data-class) D:\...\surfs_up>flask run * Serving Flask app "app.py" * 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 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)127.0.0.1 - - [18/Oct/2020 17:27:47] "GET / HTTP/1.1" 200 -127.0.0.1 - - [18/Oct/2020 17:27:47] "GET /favicon.ico HTTP/1.1" 404 -


I had this problem and could not get my Flask App to work through VS Code. There is something wrong with my environment so I searched my computer for the Anaconda Powershell, cd into the correct folder, and then typed: set FLASK_APP=app.py and ran that.

When it did not throw an error I ran flask run in the next line and it gave me my local address. One error that the powershell threw out was it could not find my file because it did not exist so I changed the file to app.py and it worked.