I have a Django app that I've deployed to production on Heroku. I have a settings package with different settings for local and production. In my local settings, I have DEBUG
set to True and I'm able to both run the server and load the homepage. In my production settings module, everything is identical except for DEBUG
being set to False and the addition of hostnames to ALLOWED_HOSTS
. For some reason, when I try to access the site (either locally or on heroku) with the production settings, I'm getting a 400 Bad Request
. I think there might be something wrong with the format of my hostnames but I'm not sure:
ALLOWED_HOSTS = ['https://test_app.herokuapp.com/','http://127.0.0.1:8000/']
What could be causing the 400 error? Should the urls be formatted differently?
Expanding on the comments above:
Because Heroku uses different fully qualified domain names for review, staging, and production apps, I've generally found it best to use a wildcard by omitting the name of the app, but including .herokuapp.com
(note the period).
Example: ALLOWED_HOSTS = ['.herokuapp.com']
.