Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tswicegood/d51_django_db
Django model manager for using specific database configurations with a model
https://github.com/tswicegood/d51_django_db
Last synced: 12 days ago
JSON representation
Django model manager for using specific database configurations with a model
- Host: GitHub
- URL: https://github.com/tswicegood/d51_django_db
- Owner: tswicegood
- Created: 2009-06-12T19:09:28.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2009-06-15T16:43:19.000Z (over 15 years ago)
- Last Synced: 2024-04-14T14:50:11.944Z (7 months ago)
- Language: Python
- Homepage:
- Size: 70.3 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
d51_django_specificdb
=====================
Custom manager for Django that allows specific databases to be used.This work stands firmly on the shoulders of giants:
http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/
http://github.com/mmalone/django-multidbUsage
-----
Import this code, then specify a custom manager for your model:objects = SpecificDatabaseManager('secondary')
In your settings.py file, you need to specify the database that you want to use
as part of the DATABASES variable:DATABASES = {
'secondary': {
'DATABASE_ENGINE': 'mysql',
'DATABASE_NAME': 'secondary_db',
'DATABASE_USER': 'some_user',
'DATABASE_PASSWORD': 'shh',
'DATABASE_OPTIONS': '',
'DATABASE_HOST': '',
'DATABASE_PORT': '',
}
}The values work just like various DATABASE_* values in a normal settings.py file.