Heroku, Django, Foreman

馋奶兔 提交于 2019-12-01 06:19:27

问题


I am following this tutorial: http://tutorial.djangogirls.org/en/domain/README.html

But when I run foreman start web as mentioned in the heroku docs at https://devcenter.heroku.com/articles/getting-started-with-python#run-the-app-locally I get this error:

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

Should I be using foreman? I read that gunicorn is what I should use, but I'm not sure exactly how to use it. I can't find any examples of how to use gunicorn to start the server rather than heroku open or python manage.py runserver

I read that gunicorn doesn't work on windows... is this true? I found this answer but not sure how to implement it.. fcntl substitute on Windows

Assuming I can't implement that fcntl substitute, what is the solution for windows? I want to use gunicorn/foreman if possible as runserver is just for development. I've been using heroku, but I'm not sure if that's the right way to go. What's the correct way to deploy/launch the server from windows? Or is Linux the only option?


回答1:


Gunicorn doesn't run on windows, so you'll need to have a separate system for running code locally. What framework are you running?

Usually you can develop locally using a built-in development server (like python manage.py runserver for Django), and just use gunicorn on Heroku itself



来源:https://stackoverflow.com/questions/29562199/heroku-django-foreman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!