Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Import settings apps of a Django project
Paste the code at the end your main settings.
It will import all settings files of your django project.
It allow to divide settings per app.
import os.path
for d in [d for d in os.listdir(os.path.dirname(__file__)) if os.path.isdir(os.path.join(os.path.dirname(__file__), d))]:
app = __import__(d)
from app.settings import *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment