0

For easier collaboration I changed the directory structure of an existing django-project like this:

├── docs
├── manage.py
├── requirements.txt
├── static
│   └── my_app
│       ├── css
│       ├── fonts
│       ├── img
│       └── js
├── templates
│   └── my_app
└── proj_name
    ├── apps
    │   └── my_app
    │       ⋮
    │       └── views.py
    ├── settings
    │   └── base.py
    ├── urls.py
    └── wsgi.py


Part of the settings-file base.py

BASE_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '..')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'the actual secret key'

Using manage.py throws errors

python manage.py makemigrations

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

To figure out the problem more exactly I ran check which actually throws a different error

python manage.py check

django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Before changing the directory-structure the project worked.

How to change the path for django-project settings-file?


Directory restructuring inspired by Best practice for Django project working directory structure

Joe
  • 1
  • 3

0 Answers0