【问题标题】:Heroku, Django, ForemanHeroku,Django,工头
【发布时间】:2015-06-16 05:13:43
【问题描述】:

我正在关注本教程: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 openpython manage.py runserver 的示例

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

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

【问题讨论】:

  • 只是一个想法......在 Windows 上浪费了这么多时间......为什么你要转向开源???
  • 我通常不使用windows,我只是在工作中使用它

标签: python django heroku gunicorn foreman


【解决方案1】:

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

通常您可以使用内置的开发服务器(如 Django 的 python manage.py runserver)在本地进行开发,并在 Heroku 本身上使用 gunicorn

【讨论】:

  • 感谢格式帮助迟到了。不知道 gunicorn 不能在 Windows 上运行,感谢您节省了挫败感。
猜你喜欢
  • 2012-09-19
  • 2013-05-29
  • 2014-08-15
  • 1970-01-01
  • 2012-03-23
  • 2015-03-06
  • 2014-02-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多