Spaces:
Sleeping
Sleeping
Commit ·
b5d550f
1
Parent(s): 9e318b0
fix error.
Browse files- flask_app/flask_app.py +9 -6
flask_app/flask_app.py
CHANGED
|
@@ -17,9 +17,9 @@ app.config['JSON_SORT_KEYS'] = False
|
|
| 17 |
CORS(app, resources={r"/*": {"origins": "*"}})
|
| 18 |
|
| 19 |
# 首页路由
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
# 带参数的路由
|
| 25 |
@app.route("/hello/<name>")
|
|
@@ -44,6 +44,7 @@ def form():
|
|
| 44 |
<a href='./'>返回首页</a>
|
| 45 |
"""
|
| 46 |
|
|
|
|
| 47 |
# 创建 RESTX API
|
| 48 |
api = Api(
|
| 49 |
app,
|
|
@@ -314,6 +315,8 @@ def not_found(error):
|
|
| 314 |
def internal_error(error):
|
| 315 |
return jsonify({'error': '服务器内部错误'}), 500
|
| 316 |
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
|
|
|
|
|
|
|
|
| 17 |
CORS(app, resources={r"/*": {"origins": "*"}})
|
| 18 |
|
| 19 |
# 首页路由
|
| 20 |
+
@app.route("/")
|
| 21 |
+
def home():
|
| 22 |
+
return render_template("index.html", message="欢迎来到 Flask Demo!")
|
| 23 |
|
| 24 |
# 带参数的路由
|
| 25 |
@app.route("/hello/<name>")
|
|
|
|
| 44 |
<a href='./'>返回首页</a>
|
| 45 |
"""
|
| 46 |
|
| 47 |
+
'''
|
| 48 |
# 创建 RESTX API
|
| 49 |
api = Api(
|
| 50 |
app,
|
|
|
|
| 315 |
def internal_error(error):
|
| 316 |
return jsonify({'error': '服务器内部错误'}), 500
|
| 317 |
|
| 318 |
+
if __name__ == '__main__':
|
| 319 |
+
port = int(os.getenv('PORT', 5000))
|
| 320 |
+
app.run(host='0.0.0.0', port=port, debug=False)
|
| 321 |
+
|
| 322 |
+
'''
|