Search code examples
pythondjangodjango-settings

In Django, how can I reuse settings.py in a new app outside of the project


I have a new Django application I am working on.

I have the following directory structure.

Django/
  appc
  project1
    appA
    appB

I would like to use the settings.py from project1 in appc. I have added the appc application to the INSTALLED_APPS under project1. I am using WSGI so I added the Django/appc directory to the python path as well.

My problem comes in when I try and extend a template from appA I am not able to load any of the Variables defined in the project1 settins.py. So I guess my question is then how can I ensure that appC is going to source the settings from appB?


Solution

  • Django apps that require access to the project settings should import and use django.conf.settings.