- 安装python,并建立虚环境, 然后安装flask基本
1
2
3
4
5
6$ sudo apt install python3 vitrualenv
$ virtualenv myflask3 #建立虚环境
$ python -m venv myflask3 #另一个建立虚环境的命令
$ cd myflask3
$ source bin/activate
$ pip install flask - 在myflask下建立app.py文档
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#coding:utf8
from flask import Flask
from flask import request,render_template
# app = Flask(__name__, template_folder='templates',static_folder='static')
app = Flask( __name__ )
def index():
return render_template('index.html')
if __name__ == '__main__':
app.debug = True
app.run( host = '0.0.0.0',port = 8080 )
# app.run(host='0.0.0.0', debug=True)