Heroku, Django, Foreman

4
我正在遵循这个教程:http://tutorial.djangogirls.org/en/domain/README.html 但是当我像Heroku文档中所述在本地运行应用程序时,运行foreman start web会出现以下错误:https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally
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

我应该使用foreman吗?我读到gunicorn是我应该使用的,但我不确定如何使用它。我找不到如何使用gunicorn启动服务器的示例,而不是使用heroku openpython manage.py runserver

我读到gunicorn在Windows上无法工作...这是真的吗?我找到了这个答案,但不确定如何实现它.. fcntl substitute on Windows

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


1
只是一个想法...为什么要在Windows上浪费这么多时间?为什么不转向开源呢? - Raja Simon
1
我通常不使用Windows,只是在工作中不得不使用它。 - ss7
1个回答

4

Gunicorn不支持Windows系统,因此您需要有一个单独的系统来在本地运行代码。您使用的是哪个框架?

通常情况下,您可以使用内置的开发服务器(例如Django的python manage.py runserver命令)在本地进行开发,并在Heroku上使用Gunicorn。


感谢您提供的格式帮助,时间已经很晚了。我不知道gunicorn在Windows上无法使用,感谢您避免了这种沮丧。 - ss7

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接