python - Django 无法通过 mod_wsgi 错误部署 [AWS]
问题描述
尝试通过 Elastic Beanstalk 服务部署我的 django 应用程序时遇到错误。本地一切正常。
我还尝试根据答案修改我的代码Django stop working with RuntimeError: populate() is not reentrant and this Target WSGI script '/opt/python/current/app/ ... /wsgi.py' cannot be loaded as Python module 没有成功。
[:error] [pid 3519] mod_wsgi (pid=3519): Target WSGI script '/opt/python/current/app/diamond/wsgi.py' cannot be loaded as Python module.
[:error] [pid 3519] mod_wsgi (pid=3519): Exception occurred processing WSGI script '/opt/python/current/app/diamond/wsgi.py'.
[:error] [pid 3519] Traceback (most recent call last):
[:error] [pid 3519] File "/opt/python/current/app/diamond/wsgi.py", line 16, in <module>
[:error] [pid 3519] application = get_wsgi_application()
[:error] [pid 3519] File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[:error] [pid 3519] django.setup(set_prefix=False)
[:error] [pid 3519] File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/__init__.py", line 24, in setup
[:error] [pid 3519] apps.populate(settings.INSTALLED_APPS)
[:error] [pid 3519] File "/opt/python/run/venv/local/lib/python3.4/site-packages/django/apps/registry.py", line 81, in populate
[:error] [pid 3519] raise RuntimeError("populate() isn't reentrant")
[:error] [pid 3519] RuntimeError: populate() isn't reentrant
此外,我的 wsgi.py 文件:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "diamond.settings")
application = get_wsgi_application()
和我的django.config
加入
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: diamond/wsgi.py
提前致谢
解决方案
推荐阅读
- gcc - GDB 无法为 x86-64 可执行文件设置断点
- python - 如何根据另一个图像透明区域获取子图像(裁剪)
- java - 将输入文件中的数据读入类方法
- python - 从缺少 setup.py 文件的 git 存储库导入库
- php - Laravel 8 - 将验证错误传递回前端
- google-apps-script - 如何为所有填写的单元格重复功能(谷歌表格)
- java - 尝试连接到 android 上的 mongodb 数据库时出错
- javascript - 循环枚举radioButton中的对象
- css - 如何使跨越多行的文本在 CSS 中每个字母垂直对齐?
- python - 如何比较熊猫系列的值