Heroku,Django,Foreman

2024-04-27 23:52:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我遵循这个教程:http://tutorial.djangogirls.org/en/domain/README.html

但是,当我运行foreman start web时,如在https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally上的heroku文档中所述,我得到了以下错误:

03:43:05 web.1  | started with pid 47516
03:43:05 web.1  | Traceback (most recent call last):
03:43:05 web.1  |   File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
03:43:05 web.1  |     "__main__", mod_spec)
03:43:05 web.1  |   File "C:\Python34\lib\runpy.py", line 85, in _run_code
03:43:05 web.1  |     exec(code, run_globals)
03:43:05 web.1  |   File "c:\Users\shenk\Documents\Programming\django_projects\djangogirls\myvenv\Scripts\gunicorn.exe\_
_main__.py", line 5, in <module>
03:43:05 web.1  |   File "c:\Users\shenk\Documents\Programming\django_projects\djangogirls\myvenv\lib\site-packages\guni
corn\app\wsgiapp.py", line 10, in <module>
03:43:05 web.1  |     from gunicorn.app.base import Application
03:43:05 web.1  |   File "c:\Users\shenk\Documents\Programming\django_projects\djangogirls\myvenv\lib\site-packages\guni
corn\app\base.py", line 12, in <module>
03:43:05 web.1  |     from gunicorn import util
03:43:05 web.1  |   File "c:\Users\shenk\Documents\Programming\django_projects\djangogirls\myvenv\lib\site-packages\guni
corn\util.py", line 9, in <module>
03:43:05 web.1  |     import fcntl
03:43:05 web.1  | ImportError: No module named 'fcntl'
03:43:05 web.1  | exited with code 1
03:43:05 system | sending SIGKILL to all processes

我应该用福尔曼吗?我读到gunicorn是我应该用的,但我不知道该怎么用。我找不到任何关于如何使用gunicorn而不是heroku open或{}来启动服务器的示例

我读到gunicorn不能用窗户。。。这是真的吗?我找到了这个答案,但不知道如何实现它。。fcntl substitute on Windows

假设NTI不能替代windows的解决方案是什么?如果可能的话,我想使用gunicorn/foreman,因为runserver只是用于开发。我一直在用heroku,但我不确定这是否正确。从windows部署/启动服务器的正确方法是什么?或者Linux是唯一的选择?在


Tags: runinpyappherokuliblineusers
1条回答
网友
1楼 · 发布于 2024-04-27 23:52:17

Gunicorn不能在windows上运行,因此需要有一个单独的系统来在本地运行代码。你在运行什么框架?在

通常,您可以使用内置的开发服务器(如python)在本地进行开发管理.py运行服务器for Django),只需在Heroku上使用gunicorn

相关问题 更多 >