-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_flask.py
48 lines (33 loc) · 1.03 KB
/
run_flask.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from flask import Flask
from flask import jsonify
from flask import render_template
from flask import request
from flask import Response
import urllib
import json
'''import sys
for place in sys.path:
print (place)'''
app = Flask(__name__, static_folder='./web', static_url_path='', template_folder='./web/template')
@app.route('/')
def home():
return app.send_static_file('index.html')
'''@app.route('/background_process')
def background_process():
try:
lang = app.request.args.get('proglang', 0, type=str)
if lang.lower() == 'python':
return jsonify(result='You are wise')
else:
return jsonify(result='Try again.')
except Exception as e:
return str(e)'''
@app.route('/login/<userid>', methods=['GET', 'POST'])
def login(userid):
print(">>>login")
#return "Say Login to my little friend: %s" % userid
return render_template('train2.html', userid=userid)
@app.route('/echo/<thing>')
def echo(thing):
return "Say hello to my little friend: %s" % thing
app.run(host='192.168.0.13', port=9999, debug=True)