当前位置:网站首页>用Pycharm开发Flask框架设置debug模式没有效果的解决办法
用Pycharm开发Flask框架设置debug模式没有效果的解决办法
2022-06-28 03:03:00 【wls.wang】
debuge模式
- 在app.run()中传入一个关键字参数debug ,app.run(debug=True),就设置当前项目为debug模式
- debug模式的两大功能:
1.当程序出现问题的时候,可以在页面中看到错误和出错的位置。
2.只要修改了项目中的‘Python’文件,程序会自动加载,不需要手动重新启动服务器。
解决办法一
这是Pycharm版本的问题。并不是flask框架本身的问题(不管你是如何设置的flask配置,还是通过加载config文件,还是通过run的时候传入形参,均没有效果)。
- 第一步
Pycharm会自动识别flask项目(即使你创建项目的时候并没有选择flask框架的模板)但是在你运行的时候依旧是下图所示,右上角以flask的logo运行的。
- 第二步

- 第三步:勾选FLASK_DEBUG选项,然后保存,返回主界面,再次运行,debug模式就已经打开了,再次运行程序,就有效果了。


运行结果效果图

解决办法二
这种办法,比较繁琐,推荐使用第一种
- 第一步

- 第二步

- 第三步:复制脚本路径,把原来的删除掉

- 第四步:新添加一个,然后应用,保存之后运行脚本,就ok了。

你可能感兴趣的文章: - 您不知道的Python中global、nonlocal哪些事儿
- Python之深浅拷贝
边栏推荐
- 新手开哪家的证券账户是比较好?股票开户安全吗
- "Five layer" architecture of cloud applications and services
- 爱普生L3153打印机如何清洗喷头
- 大咖说·计算讲谈社|什么是东数西算要解决的核心问题?
- 开启创客教育造物学的领域
- Summary of SQL basic syntax for C #
- Simple implementation of cool GUI window based on WPF
- Resource management, high availability and automation (medium)
- crond BAD FILE MODE /etc/cron. d
- Extensible database (Part 2)
猜你喜欢

What is the core problem to be solved in the East and West?

Execution plan in MySQL of database Series

Simple implementation of cool GUI window based on WPF

第二轮红队免费公开课来袭~明晚八点!

Object class, and__ new__,__ init__,__ setattr__,__ dict__

从遇见大咖到成为大咖,昇腾AI开发者创享日给开发者带来无限可能

Basic operation of stack (implemented in C language)

爱普生L3153打印机如何清洗喷头

STM32 peripheral SDIO and SD card configuration

Why is the service implementation class always red
随机推荐
MySQL 数据库的自动备份操作
十年职场软件工程师感悟
nn. Parameter and torch nn. Init series of functions to initialize model parameters
No result defined&nbsp…
Import an excel file, solve the problem of skipping blank cells without reading and moving the subscript forward, and return_ BLANK_ AS_ Null red
Summary of SQL basic syntax for C #
数的每一位平方和
可扩展数据库(上)
Redis cluster setup [simple]
mysql获取当前时间是一年的第多少天
Paging query optimization in MySQL of database Series
MySQL error
Websocket (simple experience version)
Object class, and__ new__,__ init__,__ setattr__,__ dict__
STM32外设SDIO和SD卡的配置
Research and arrangement of electronic map coordinate system
在牛客中使用JS编程题【split】
kubernetes资源对象介绍及常用命令
database
collections. Use of defaultdict()