Ubuntu Droplet 上的 Flask 应用程序 运行 中缺少 Windows 模块
Missing Windows module in Flask app running on Ubuntu Droplet
我正在尝试 运行 Ubuntu Droplet 上的 Flask 应用程序,但是当我尝试 运行 使用 python app.py
的应用程序时,我得到以下回溯:
* Running on http://0.0.0.0:4000/ (Press CTRL+C to quit)
* Restarting with stat
Traceback (most recent call last):
File "app.py", line 49, in <module>
app.run('0.0.0.0', port=4000, debug=True)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 772, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 622, in run_simple
reloader_type)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 269, in run_with_reloader
reloader.run()
File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 159, in run
for filename in chain(_iter_module_files(), self.extra_files):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 70, in _iter_module_files
for package_path in getattr(module, '__path__', ()):
File "/usr/lib/python2.7/dist-packages/six.py", line 116, in __getattr__
_module = self._resolve()
File "/usr/lib/python2.7/dist-packages/six.py", line 105, in _resolve
return _import_module(self.mod)
File "/usr/lib/python2.7/dist-packages/six.py", line 76, in _import_module
__import__(name)
ImportError: No module named _winreg
我无法使用 pip 或 apt-get 安装软件包,因为我很确定这是 Windows 特定的模块。有什么办法可以解决这个问题吗?
我遇到了同样的问题。据我了解,这是因为上一个 Werkzeug 版本中的一些更改改变了重新加载器。
安装 watchdog 可以解决我的问题:
pip install watchdog
现在,我看到的不是“* Restart with stat”,而是“* Restart with inotify reloader”,一切正常。
我正在尝试 运行 Ubuntu Droplet 上的 Flask 应用程序,但是当我尝试 运行 使用 python app.py
的应用程序时,我得到以下回溯:
* Running on http://0.0.0.0:4000/ (Press CTRL+C to quit)
* Restarting with stat
Traceback (most recent call last):
File "app.py", line 49, in <module>
app.run('0.0.0.0', port=4000, debug=True)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 772, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 622, in run_simple
reloader_type)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 269, in run_with_reloader
reloader.run()
File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 159, in run
for filename in chain(_iter_module_files(), self.extra_files):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/_reloader.py", line 70, in _iter_module_files
for package_path in getattr(module, '__path__', ()):
File "/usr/lib/python2.7/dist-packages/six.py", line 116, in __getattr__
_module = self._resolve()
File "/usr/lib/python2.7/dist-packages/six.py", line 105, in _resolve
return _import_module(self.mod)
File "/usr/lib/python2.7/dist-packages/six.py", line 76, in _import_module
__import__(name)
ImportError: No module named _winreg
我无法使用 pip 或 apt-get 安装软件包,因为我很确定这是 Windows 特定的模块。有什么办法可以解决这个问题吗?
我遇到了同样的问题。据我了解,这是因为上一个 Werkzeug 版本中的一些更改改变了重新加载器。
安装 watchdog 可以解决我的问题:
pip install watchdog
现在,我看到的不是“* Restart with stat”,而是“* Restart with inotify reloader”,一切正常。