【发布时间】:2022-01-10 08:08:21
【问题描述】:
我在部署我的第一个 Django 项目时遇到问题。
这是我的config.yml:
global:
application_name: testapp
branch: null
default_ec2_keyname: aws-eb
default_platform: Python 3.8 running on 64bit Amazon Linux 2
default_region: us-west-2
include_git_submodules: true
instance_profile: null
platform_name: null
platform_version: null
profile: eb-cli
repository: null
sc: null
workspace_type: Application
这是我的django.config:
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: djangoproject.wsgi:application
我已关注this doc。但是在我做了eb create testapp-env 之后,我得到了 502 错误:
image of the error
如果您需要,我会提供更多信息。提前感谢您的帮助。
这是web.stdout.log中的错误:
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
更新
我的 django 项目使用 python-socketio,这是我的 wsgi.py:
from django.core.wsgi import get_wsgi_application
import socketio
from post.socketioserver import sio # <- it's just my socket io code
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoproject.settings')
django_app = get_wsgi_application()
application = socketio.WSGIApp(sio, django_app)
我收到另一个错误:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
【问题讨论】:
-
在 AWS 控制台中打开弹性 beanstalk 环境,然后请求日志,以便您获取更多信息。
-
我应该查看哪个日志文件?日志文件很多...
-
我可以看到
web.stdout.log错误。
标签: python django amazon-web-services amazon-elastic-beanstalk