Version 1.1 by Leon Poon on 2018/12/24 09:48

Show last authors
1 First, [[set up a virtualenv>>url:https://wiki.codepowered.com/wiki/How_to_Create_a_VirtualEnv]].
2
3 [[In the virtualenv, install flask>>url:https://wiki.codepowered.com/wiki/How_to_add_libraries_to_a_virtualenv]], then try out this .py file.
4
5 {{{from flask import Flask
6
7 app = Flask(__name__)
8
9 @app.route('/', methods=['GET'])
10 def index():
11 return 'Hi'
12
13 app.run()
14 }}}
15
16 Run this script [[in the virtualenv>>url:https://wiki.codepowered.com/wiki/How_to_Run_a_Python_Script_in_a_VirtualEnv]]. It will not exit.
17
18 Now you should be able to access [[http:~~/~~/localhost:5000/>>url:http://localhost:5000/]] in your web browser.