简体   繁体   中英

Heroku, Django, Foreman

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM