File: settings.py

package info (click to toggle)
python-django-pgtrigger 4.15.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 956 kB
  • sloc: python: 4,412; makefile: 114; sh: 8; sql: 2
file content (46 lines) | stat: -rw-r--r-- 1,383 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import copy

import dj_database_url

SECRET_KEY = "django-pgtrigger"
# Install the tests as an app so that we can make test models
INSTALLED_APPS = [
    "pgtrigger",
    # For testing purposes
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.postgres",
    "psqlextra",
    "pgtrigger.tests",
    "pgtrigger.tests.syncdb_app",
]

# Database url comes from the DATABASE_URL env var
# We have some multi-database and multi-schema tests
DATABASES = {
    "default": dj_database_url.config(),
    "sqlite": {"ENGINE": "django.db.backends.sqlite3", "NAME": "test_sqlite"},
}

DATABASES["other"] = copy.deepcopy(DATABASES["default"])
DATABASES["other"]["NAME"] += "_other"

DATABASES["default"]["ENGINE"] = "psqlextra.backend"

DATABASES["order"] = copy.deepcopy(DATABASES["default"])
DATABASES["order"]["OPTIONS"] = {"options": "-c search_path=order"}
DATABASES["receipt"] = copy.deepcopy(DATABASES["default"])
DATABASES["receipt"]["OPTIONS"] = {"options": "-c search_path=receipt"}

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

# Ensure partitioned models dont get migrated for non-default DBs
DATABASE_ROUTERS = ["pgtrigger.tests.models.Router"]

# Turn off pgtrigger migrations for normal manage.py use
PGTRIGGER_MIGRATIONS = False

# Ensure that we always install triggers if running locally
PGTRIGGER_INSTALL_ON_MIGRATE = True

USE_TZ = False