#24815: Custom settings for database alias
--------------------------------+--------------------------------------
Reporter: MikeVelazcoMtz | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by MikeVelazcoMtz):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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**
> {{{#!python
> 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"),
> }
> },
> }
> }}}
New description:
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**
{{{#!python
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/24815#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/072.94f0e5ad9f3a821dd9303a102f355e2b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.