PythonAnywhere 如何启用线程

PythonAnywhere How to Enable Threads

我总是得到这个:

you can enable thread by --enable-thread ...

谁能告诉我具体怎么做? 谢谢

2016-07-23 15:06:01 lock engine: pthread robust mutexes
2016-07-23 15:06:01 thunder lock: disabled (you can enable it with --thunder-lock)
2016-07-23 15:06:01 uwsgi socket 0 bound to UNIX address /var/sockets/hassanalvi.pythonanywhere.com/socket fd 7
2016-07-23 15:06:01 Python version: 2.7.6 (default, Jun 22 2015, 18:01:27)  [GCC 4.8.2]
2016-07-23 15:06:01 *** Python threads support is disabled. You can enable it with --enable-threads ***
2016-07-23 15:06:01 Python main interpreter initialized at 0x146b720

*** Python threads support is disabled. You can enable it with --enable-threads ***

不幸的是 python 任何不支持线程的地方都是 Web 服务器,check out this article. However, there is a fix if you just want to run a task

这是一个旧的 post,但就像我在寻找解决方案时偶然发现它一样,其他人也可能如此。
如果您是其他人中的一员,我只是想让您知道,使用 multiprocessing.Process 而不是 threading.Thread 对我来说就像一个魅力。
因此,如果流程适合您的场景 - 我的是 运行 flask 应用程序中的脚本,但仍然及时响应 post-请求 - 这是一个更简单的解决方案。