Answer the question
In order to leave comments, you need to log in
How to move a Django settings file out of a project?
The question is:
The project has a settings folder with three settings files: base.py, local.py, production.py.
production.py inherits base.py settings, overrides some, adds some. Is it possible to somehow move this file from the project folder to a separate folder and connect it so that everything works correctly in production?
Answer the question
In order to leave comments, you need to log in
In __init__.py determine where the project is running and port the desired config
What for? Do it in this way:
python manage.py runserver --settings config.settings.production
Perhaps this option will work for you:
- n
|-- base.py
- settings
|-- local.py
|-- production.py
ln -sf n/base.py settings/base.py
. from .base import *
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question