简体   繁体   中英

Trouble Deploying a Django App to Amazon AWS Elastic Beanstalk

I know this question has been asked a lot but none of the solutions are working for me. I am trying to Deploy a Django 1.8 web app in elastic beanstalk. It works when Debug is set to true but not when set to false. This is a brand new app so other than changing the debug mode I have not done anything. I have tried:

ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
ALLOWED_HOSTS = ['.elasticbeanstalk.com', 'elasticbeanstalk.com.']
ALLOWED_HOSTS = ['RDS_HOSTNAME']
ALLOWED_HOSTS = ['.ec2-52-10-0-17.us-west-2.compute.amazonaws.com']
ALLOWED_HOSTS = [
    '.revchip.elasticbeanstalk.com'
    'revchip.elasticbeanstalk.com.'
]
ALLOWED_HOSTS = ['revchip.elasticbeanstalk.com', 'ec2-52-10-0-17.us-west-2.compute.amazonaws.com']

With Some solutions it gives a Bad Request 400 error but with some others it does a The requested URL / was not found on this server. such as if I do the ['*'] solution

Hi I had the exactly same issue and luckily had it solved by inserting project parent directory into sys.path on wsgi.py

import sys, os
sys.path.insert(0, '/opt/python/current/app')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your.settings')

hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM