Settings file for multiple environments?

31 views
Skip to first unread message

ANi

unread,
Apr 18, 2019, 12:00:17 AM4/18/19
to Django users

Hi,
I divided my settings into different files, but I think it's not working on Heroku, here are my code:

# This is abcd/setting/hk.py
from .base import *
import dj_database_url


DATABASES
= {
 
'default': dj_database_url.config()
}


ALLOWED_HOSTS.append('abcdmyapp.herokuapps.com')
WSGI_APPLICATION
= 'abcd.wsgi.hk.application'
MIDDLEWARE.append('whitenoise.middleware.WhiteNoiseMiddleware')

DEBUG
= False


I doubt these two configurations because I still can run my app in debug mode but got a error about not allowing the host and there is no folder created for static files.


More info:

# This is base.py
# no DATABASES, DEBUG and WSGI_APPLICATION

ALLOWED_HOSTS
= ['127.0.0.1']
MIDDLEWARE
= [
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
....
]


# This is Procfile

web
: gunicorn abcd.wsgi.hk
release
: python manage.py migrate
web
: python manage.py runserver 0.0.0.0:$PORT

# This is abcd/wsgi/hk.py
 
import os
from django.core.wsgi import get_wsgi_application
os
.environ.setdefault("DJANGO_SETTINGS_MODULE", "abcd.settings.hk")
application
= get_wsgi_application()



Ayser shuhaib

unread,
Apr 18, 2019, 1:10:04 AM4/18/19
to django...@googlegroups.com
Are you sure about the directory?
I mean is it “ abcd.setting.hk” or “abcd.settings.hk” ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8a6fe85d-2349-4b58-86df-6e2a4df00500%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ANi

unread,
Apr 18, 2019, 1:17:30 AM4/18/19
to Django users
yes, it is "abcd.settings.hk". And I think it will show error if it's wrong (?

Ayser shuhaib於 2019年4月18日星期四 UTC+8下午1時10分04秒寫道:
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages