我正在遵循这个教程: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 open
或python manage.py runserver
我读到gunicorn在Windows上无法工作...这是真的吗?我找到了这个答案,但不确定如何实现它.. fcntl substitute on Windows
假设我无法实现那个fcntl替代方案,那么Windows的解决方案是什么?如果可能的话,我想使用gunicorn/foreman,因为runserver只用于开发。我一直在使用heroku,但我不确定这是否是正确的方法。从Windows部署/启动服务器的正确方法是什么?或者Linux是唯一的选择吗?