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
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,38 @@ TASKS = {
68
68
69
69
The `id_function` must return a UUID (either `uuid.UUID` or string representation). Additionally, the PostgreSQL-specific [`RandomUUID`](https://docs.djangoproject.com/en/stable/ref/contrib/postgres/functions/#django.contrib.postgres.functions.RandomUUID) or other database expressions are supported on Django 6.0+.
70
70
71
+
### Using a separate database
72
+
73
+
Database routing is controlled by Django's standard database router API. If you want
74
+
`django_tasks_db` models to use a separate database, define a router.
75
+
76
+
> **Note:** In the example below, `"task_queue"` is a placeholder. You should replace it with the specific database **alias** you have configured in your `settings.DATABASES` dictionary.
77
+
78
+
```python
79
+
classTaskDBRouter:
80
+
defdb_for_read(self, model, **hints):
81
+
if model._meta.app_label =="django_tasks_database":
82
+
return"task_queue"
83
+
returnNone
84
+
85
+
defdb_for_write(self, model, **hints):
86
+
if model._meta.app_label =="django_tasks_database":
0 commit comments