【python】flask 开启 debug 模式
2024-10-19 12:37:33
方法一: 直接在run的时候添加debug
from flask import Flask
app = Flask(__name__) @app.route('/')
def hello_world():
return 'Hello Flask!' if __name__ == '__main__':
app.run(debug=True)
方法二: 添加配置文件
1 添加config.py
# encoding:utf-8
DEBUG = True
2 index.py 引入config
from flask import Flask
import config
app = Flask(__name__)
app.config.from_object(config) @app.route('/')
def hello_world():
return 'Hello Flask!' if __name__ == '__main__':
app.run()
查看效果:
浏览器 效果:
修改 index.py 并保存
刷新浏览器:
over!
最新文章
- HBase相关
- Oracle、SQL Server、MySQL分页方法
- Codeforces Gym 100650C The Game of Efil DFS
- 常用PHP框架功能对比表
- [LeetCode] 315. Count of Smaller Numbers After Self (Hard)
- 看个人思路吧,清晰的话就简单 CodeForces 271A - Beautiful Year
- WPC文件修改还原pin进度
- jQuery ajax在GBK编码下表单提交终极解决方案(非二次编码方法)(转)
- java代码发送JSON格式的httpPOST请求
- [HNOI2012]射箭
- 20160227.CCPP体系详解(0037天)
- Python报错:ImportError: No module named src.data_layer
- python 之 函数的参数
- Install OpenCV-Python in Ubuntu
- atmega328 熔丝
- sar监控工具详解
- PHP5.4新特性之上传进度支持Upload progress
- Qt+json
- 【PHP】 mysqli_autocommit() 函数
- Leecode刷题之旅-C语言/python-434 字符串中的单词数