Opened 10 years ago
Last modified 10 years ago
#24815 closed New feature
Custom settings for database alias — at Version 1
Reported by: | Miguel Angel Velazco | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
It could be excelet to be able to set custom settings depending the database alias. An excelent example could be the management of the media files.
Maybe to do something like this:
settings.py
import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'uno.sqlite3'), }, 'another': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'uno.sqlite3'), 'ADDITIONAL_SETTINGS': { 'MEDIA_ROOT': os.path.join(BASE_DIR, "custom_media"), } }, }
Is important to say that this custom settings should be applied when a database router switch databases.
Note:
See TracTickets
for help on using tickets.