【发布时间】:2017-04-22 19:27:01
【问题描述】:
我正在努力跟上鹡鸰的速度。我在远程服务器上运行它。我已经安装了一个虚拟环境,然后我按照这里的步骤切换到虚拟环境并安装了 wagtail:http://docs.wagtail.io/en/v1.9/getting_started/tutorial.html
pip install wagtailwagtail start rockercd rockerpip install -r requirements.txtpython manage.py migratepython manage.py createsuperuser
指南中的下一步是通过运行测试安装是否有效:
python manage.py runserver
在使用远程服务器时我不能这样做,而且服务器上已经有一个 Django 应用程序正在运行(使用 uwsgi)。
所以我现在正尝试通过 uwsgi 连接到这个 wagtail 应用程序。
使用启动现有应用程序的字符串作为模板,我已经修改它以将套接字绑定到 wagtail 应用程序:-
uwsgi --chdir=/opt/rocker/rocker --module=rocker.wsgi:application --env DJANGO_SETTINGS_MODULE=rocker.settings --master --pidfile=/tmp/rocker.pid --socket=/opt/rocker/core.sock --processes=5 --uid=www-data --gid=www-data --harakiri=20 --max-requests=5000 --vacuum --home=/opt/rocker --daemonize=/var/log/uwsgi/rocker.logroot@caspium:/etc/init.d#
但是应用程序没有启动... uwsgi 日志中的错误说明如下:-
*** Operational MODE: preforking ***
Traceback (most recent call last):
File "./rocker/wsgi.py", line 18, in <module>
application = get_wsgi_application()
File "/opt/rocker/local/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
django.setup(set_prefix=False)
File "/opt/rocker/local/lib/python2.7/site-packages/django/__init__.py", line 22, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/opt/rocker/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/opt/rocker/local/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/opt/rocker/local/lib/python2.7/site-packages/django/conf/__init__.py", line 116, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
**django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.**
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 4617)
spawned uWSGI worker 1 (pid: 4622, cores: 1)
spawned uWSGI worker 2 (pid: 4623, cores: 1)
spawned uWSGI worker 3 (pid: 4624, cores: 1)
spawned uWSGI worker 4 (pid: 4625, cores: 1)
spawned uWSGI worker 5 (pid: 4626, cores: 1)
django.core.exceptions.ImproperlyConfigured:SECRET_KEY 设置 不能为空。
我对此进行了研究,发现了这个Django: ImproperlyConfigured: The SECRET_KEY setting must not be empty,它建议添加
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings.local")
在manage.py 我做到了。这并没有解决任何问题。
我还发现了这个django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty,它说您需要在settings.py 中指定的密钥
但是在 wagtail 项目中没有 settings.py
我创建了一个并添加了一个密钥,但仍然收到错误消息。
谁能告诉我如何解决这个问题,以便我可以运行 uwsgi 连接到 wagtail,并测试它是否正常工作。
谢谢
【问题讨论】:
标签: python django uwsgi wagtail