我正在将应用程序释放到Elasticbeanstalk上。访问该网址时,我收到无效的HTTP_HOST标头:“ mysite.com”。
我已将网址添加到我的settings.py中。
这是我的设置文件:
ALLOWED_HOSTS = ['mysite.com/','.mysite.com/', '127.0.0.1:8000', '127.0.0.1', 'localhost', 'localhost:8000', '13.59.177.101', '127.0.0.1']
这是我的python.config文件:
container_commands:
01_migrate:
command: "source /opt/python/run/venv/bin/activate && python manage.py migrate"
leader_only: true
02_collectstatic:
command: "source /opt/python/run/venv/bin/activate &&python manage.py collectstatic --noinput"
option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "project.settings"
PYTHONPATH: "$PYTHONPATH"
"ALLOWED_HOSTS": ".elasticbeanstalk.com"
"aws:elasticbeanstalk:container:python":
WSGIPath: "/opt/python/current/app/project/wsgi.py"
StaticFiles: "/static/=www/static/"
packages:
yum:
postgresql95-devel: []
我的代码在本地可以正常工作。不知道该怎么办。请帮忙!