Flask in Windows


I’m using Python 2.7.17 on Windows 8, virtualenv already installed (pip install virtualenv), here’s my simple step to create hello world style app

$ set FLASK_APP=app.py
$ set FLASK_ENV=development
$ virtualenv venv
$ cd venv/Scripts
$ activate
$ pip install flask
$ cd ..
$ touch app.py
$ subl app.py
-------------------------------
from flask import Flask

app = Flask(__name__)

@app.route('/')
def welcome():
return '<p>welcome to the jungle</p>'

if __name__ == '__main__':
app.run(debug=True)
-------------------------------
$ python app.py

or

$ flask run
Then, point browser to http://localhost:5000

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s