本地主机停止更新时,各种烧瓶/ python脚本运行,我该如何解决这个问题? [英] Localhost has stopped updating when various flask/python scripts are run, how do I fix this?

查看:172
本文介绍了本地主机停止更新时,各种烧瓶/ python脚本运行,我该如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Flask测试了几个 .py 文件,经常引用127.0.0.1:5000来看看它们是否与HTML正确接口,在运行 .py 后,我得到如下正常:

  *在http://127.0.0.1:5000/ 
上运行*使用重新加载程序重新启动

但是,127.0.0.1:5000在运行脚本时突然停止了更新,从我的计算机启动以来第一次运行脚本之后就保持原样(重新启动计算机是我发现的唯一方法重新审视我的工作)。要确认这不是 .py 文件或我的模板中的问题,Flask的 app.run(debug = True)不会更新这个localhost页面。有什么办法可以解决这个问题吗?



这个问题可能涉及或可能不涉及两件事:

(1)我没有使用virtualenv,而是简单地从我的桌面上的文件夹目录运行 .py 文件(遵循适当的Flask和模板格式(2) 在问题开始的时候,我用pip安装了SQLAlchemy和它的Flash扩展,Flask-SQLAlchemy。$ b $通过在命令行中运行 $ netstat -a -o 来跟踪进程,事实证明,这不是一个代码错误,而是pythonw.exe的多个实例,这可以在任务管理器中处理。我不知道为什么进程在关闭所有python窗口后继续运行,或者为什么它继续与 127.0.0.1:5000 进行通信,所以对此的想法仍然将不胜感激。


I've been testing out a few .py files with Flask, referring to 127.0.0.1:5000 frequently to see if they're interfacing correctly with the HTML, after running the .py I'm getting the following as normal:

 * Running on http://127.0.0.1:5000/
 * Restarting with reloader

However, 127.0.0.1:5000 has suddenly stopped updating when scripts are run, remaining as it was after the first time a script was run since my computer has been turned on (restarting the machine is the only way I've found to take a fresh look at my work). To confirm that it's not an issue within .py files or my templates, Flask's hello world example with app.run(debug=True) does not update this localhost page when run. Is there any way to remedy this?

Two things that may or may not be involved with this issue:
(1) I am not using virtualenv but simply running .py files from folder directories on my desktop (following proper format for Flask and the template engine, though).

(2) Around the time the problem started I installed SQLAlchemy and its Flash extension, Flask-SQLAlchemy with pip.

解决方案

After tracking the processes down by running $ netstat -a -o in the command line, it turns out it wasn't a code error, but rather multiple instances of pythonw.exe, which can be taken care of in the Task Manager. I'm not sure why the processes keep running after I close out of all python windows, or why it keeps communicating with 127.0.0.1:5000, however, so thoughts on this would still be appreciated.

这篇关于本地主机停止更新时,各种烧瓶/ python脚本运行,我该如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆