Last modified by Leon Poon on 2021/03/23 13:17

Hide last authors
Leon Poon 4.1 1 First, [[set up a virtualenv>>doc:Computing Newbies.Python Newbies.How to Create a VirtualEnv.WebHome]].
Leon Poon 1.1 2
Leon Poon 3.1 3 [[In the virtualenv, install flask>>doc:Computing Newbies.Python Newbies.How to add libraries to a virtualenv.WebHome]], then try out this .py file.
Leon Poon 1.1 4
Leon Poon 2.1 5 {{code language="python"}}
6 from flask import Flask
Leon Poon 1.1 7
8 app = Flask(__name__)
9
10 @app.route('/', methods=['GET'])
11 def index():
12 return 'Hi'
13
14 app.run()
Leon Poon 2.1 15 {{/code}}
Leon Poon 1.1 16
Leon Poon 5.1 17 Run this script [[in the virtualenv>>doc:Computing Newbies.Python Newbies.How to Run a Python Script in a VirtualEnv.WebHome]]. It will not exit.
Leon Poon 1.1 18
19 Now you should be able to access [[http:~~/~~/localhost:5000/>>url:http://localhost:5000/]] in your web browser.