article

Saturday, June 11, 2016

Python Flask install and run

 Python Flask Install and run

Flask is a web application framework written in Python. Armin Ronacher, who leads an international group of Python enthusiasts named Pocco, develops it. Flask is based on Werkzeug WSGI toolkit and Jinja2 template engine. Both are Pocco projects.

1. Create folder name flaskmyproject
2. py -3 -m venv venv
3. venv\Scripts\activate
4. pip install flask
5. flask --version
6. mkdir demoapp
7. flask run

http://127.0.0.1:5000/

app.py
 
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
   return 'Hello Worlddfdsf'

if __name__ == '__main__':
   app.run()

RUN
C:\>cd flaskmyproject
C:\flaskmyproject>venv\Scripts\activate
(venv) C:\flaskmyproject>cd demoapp
(venv) C:\flaskmyproject\demoapp>flask run
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Related Post