python - 使用 windowsapi reloader 重启
问题描述
我运行我的烧瓶代码。起初,没关系,但有时它不起作用,我得到了这个错误:
使用 windowsapi reloader 重启
我的代码:
x = pd.read_csv('clas.csv')
app = Flask(__name__)
@app.route('/<x>')
class QuotesView(FlaskView):
def index(self):
return "<br>".join(x)
QuotesView.register(app)
if __name__ == '__main__':
app.run(debug=False)
解决方案
在
@app.route('/<x>')
class QuotesView(FlaskView):
def index(self):
return "<br>".join(x) QuotesView.register(app)
当然,这不是问题,你改变了一些东西,我认为原始代码是
@app.route('/<x>')
def index(self):
return "<br>".join(x) QuotesView.register(app)
然后你决定将这个函数包含在一个类中class QuotesView(FlaskView)
,这样就不会像以前那样了。
是不是?:)
根据以下评论
问题中的代码给出了错误消息NameError: name 'FlaskView' is not defined
,而不是您提到的错误消息,所以肯定有一些改变。
推荐阅读
- php - 如何在laravel中将docx转换为pdf文件
- java - 使用 Jwt spring security 进行 Springboot 单元测试
- azure - 如何将 excel 读取为 pyspark 数据框
- python - 在 PyTorch 中标准化像素值
- java - 如何清除部署在 tomcat 中的应用程序的空闲或孤立 websocket 连接
- angular - Angular 11 - 测试用例编写 - Jasmine - 弃用问题
- php - 如何处理 JSON 中的主详细信息更新和删除请求
- javascript - 使用反应原生 youtube iframe 嵌入 youtube 视频时出现黑屏
- firebase - Firebase TypeError:_lib_firebase__WEBPACK_IMPORTED_MODULE_2__.default.auth 不是函数-VueJs
- python - Seaborn kdeplot 累积在按色调分割时不上升到 1