You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+56-1
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ To disable queue name validation, set `QUEUES` to `[]`.
125
125
126
126
### The database backend worker
127
127
128
-
First, you'll need to add `django_tasks.backends.database`to `INSTALLED_APPS`:
128
+
First, you'll need to add `django_tasks.backends.database` to `INSTALLED_APPS`:
129
129
130
130
```python
131
131
INSTALLED_APPS= [
@@ -238,6 +238,61 @@ Whilst signals are available, they may not be the most maintainable approach.
238
238
-`django_tasks.signals.task_enqueued`: Called when a task is enqueued. The sender is the backend class. Also called with the enqueued `task_result`.
239
239
-`django_tasks.signals.task_finished`: Called when a task finishes (`SUCCEEDED` or `FAILED`). The sender is the backend class. Also called with the finished `task_result`.
240
240
241
+
### Database Routers
242
+
243
+
**Define Multiple Databases in settings.py**
244
+
245
+
```python
246
+
DATABASES= {
247
+
'default': {
248
+
'ENGINE': 'django.db.backends.postgresql',
249
+
'NAME': 'default_db',
250
+
'USER': 'default_user',
251
+
'PASSWORD': 'default_password',
252
+
'HOST': 'localhost',
253
+
'PORT': '5432',
254
+
},
255
+
'queue_db': {
256
+
'ENGINE': 'django.db.backends.postgresql',
257
+
'NAME': 'queue_db',
258
+
'USER': 'queue_user',
259
+
'PASSWORD': 'queue_password',
260
+
'HOST': 'localhost',
261
+
'PORT': '5432',
262
+
},
263
+
'analytics_db': {
264
+
'ENGINE': 'django.db.backends.postgresql',
265
+
'NAME': 'analytics_db',
266
+
'USER': 'analytics_user',
267
+
'PASSWORD': 'analytics_password',
268
+
'HOST': 'localhost',
269
+
'PORT': '5432',
270
+
},
271
+
}
272
+
```
273
+
274
+
**Specify the Router in settings.py**
275
+
276
+
In settings.py, specify the `DATABASE_ROUTERS` setting to point to your custom router class.
0 commit comments