Reputation: 7448
I'm trying to set multiple allowed hosts in django
I have setting configured in production settings production.py
as
ALLOWED_HOSTS = env('DJANGO_ALLOWED_HOSTS')
which I can then set on heroku with:
heroku config:set 'DJANGO_ALLOWED_HOSTS' = 'www.example.com'
However how can I add multiple hosts via this method?
Upvotes: 3
Views: 7717
Reputation: 93
To define multiple values for allowed hosts in settings.py
file use like:
ALLOWED_HOSTS = ['000.08.10.11','111.22.33.44','www.abcdefgh.com']
Upvotes: 6
Reputation: 43300
You can provide a delimiter then split the string in django
ALLOWED_HOSTS = env('DJANGO_ALLOWED_HOSTS').split(',')
heroku config:set 'DJANGO_ALLOWED_HOSTS' = 'www.example.com,foo.com'
Upvotes: 12