我使用最新版本的cookiecutter-django构建了一个 Django 项目,它似乎在我的本地计算机上以及当我python manage.py runserver
使用各种设置文件运行它时运行良好。我正在尝试在 Digital Ocean(运行 Ubuntu 16.04)上测试我的 Gunicorn 服务器,但由于某种原因,在使用该服务器时无法让服务器正常运行production.py
。
当我在 bash 上执行以下命令时:
gunicorn --bind 0.0.0.0:8000 --env DJANGO_SETTINGS_MODULE=config.settings.test --preload config.wsgi
一切正常,我得到了这些:
[2018-02-18 23:31:14 -0500] [31662] [INFO] Starting gunicorn 19.7.1
[2018-02-18 23:31:14 -0500] [31662] [INFO] Listening at: http://0.0.0.0:8000 (31662)
[2018-02-18 23:31:14 -0500] [31662] [INFO] Using worker: sync
[2018-02-18 23:31:14 -0500] [31666] [INFO] Booting worker with pid: 31666
但是当我没有指定设置文件并默认为production.py
withgunicorn --bind 0.0.0.0:8000 --preload config.wsgi
时,环境变量DJANGO_SETTINGS_MODULE
设置为config.settings.production
,我只得到这些:
DEBUG 2018-02-18 23:31:55,786 base 31681 140442914699008 Configuring Raven for host: <raven.conf.remote.RemoteConfig object at 0x7fbb5cc0b668>
INFO 2018-02-18 23:31:55,786 base 31681 140442914699008 Raven is not configured (logging is disabled). Please see the documentation for more information.
它几乎只是卡在那里。什么可能导致此问题?