-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (43 loc) · 1.4 KB
/
main.py
File metadata and controls
50 lines (43 loc) · 1.4 KB
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
49
50
#encoding:utf-8
from flask import Flask
from flask import request
from flask import render_template
import sofc_sfepy
import time
# import threading
app = Flask(__name__)
# progress_percent = '0'
@app.route('/')
def index():
return render_template('index.html')
@app.route('/fem', methods=['GET', 'POST'])
def fem():
# global progress_percent
return render_template('fem.html')
@app.route('/result3d',methods = ['POST', 'GET'])
def result():
# global progress_percent
if request.method == 'POST':
result = request.form
sofc_sfepy.setParams("params.py",result)
# progress_percent="20"
# if "计算暂态" in result.keys():
# sofc_sfepy.setTransient("sofc_sfepy_data3d.py",True)
# else:
# sofc_sfepy.setTransient("sofc_sfepy_data3d.py", False)
sofc_sfepy.run("sofc_sfepy_data3d.py", result["计算结果格式"])
# progress_percent="80"
tick = str(int(time.time()))
if result["计算结果格式"]=="vtk":
sofc_sfepy.post(3,tick)
# progress_percent="100"
return render_template("result3d.html",result=result,tick=tick)
@app.route('/docs')
def doc():
return render_template('docs.html')
@app.route('/about')
def about():
return render_template('about.html')
if __name__ == '__main__':
# app.debug = True
app.run(host="0.0.0.0",port=80, threaded=False)