File: settings.py

package info (click to toggle)
django-prometheus 2.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 568 kB
  • sloc: python: 1,776; sh: 5; makefile: 3
file content (159 lines) | stat: -rw-r--r-- 4,653 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import os
import tempfile

from testapp.helpers import get_middleware

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ")0-t%mc5y1^fn8e7i**^^v166@5iu(&-2%9#kxud0&4ap#k!_k"
DEBUG = True
ALLOWED_HOSTS = []


# Application definition
INSTALLED_APPS = (
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "django_prometheus",
    "testapp",
)


MIDDLEWARE = get_middleware(
    "django_prometheus.middleware.PrometheusBeforeMiddleware",
    "django_prometheus.middleware.PrometheusAfterMiddleware",
)

ROOT_URLCONF = "testapp.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]

WSGI_APPLICATION = "testapp.wsgi.application"


DATABASES = {
    "default": {
        "ENGINE": "django_prometheus.db.backends.sqlite3",
        "NAME": "db.sqlite3",
    },
    # Comment this to not test django_prometheus.db.backends.postgres.
    "postgresql": {
        "ENGINE": "django_prometheus.db.backends.postgresql",
        "NAME": "postgres",
        "USER": "postgres",
        "PASSWORD": "",
        "HOST": "localhost",
        "PORT": "5432",
    },
    # Comment this to not test django_prometheus.db.backends.postgis.
    "postgis": {
        "ENGINE": "django_prometheus.db.backends.postgis",
        "NAME": "postgis",
        "USER": "postgres",
        "PASSWORD": "",
        "HOST": "localhost",
        "PORT": "5432",
    },
    # Comment this to not test django_prometheus.db.backends.mysql.
    "mysql": {
        "ENGINE": "django_prometheus.db.backends.mysql",
        "NAME": "django_prometheus_1",
        "USER": "root",
        "PASSWORD": "",
        "HOST": "127.0.0.1",
        "PORT": "3306",
    },
    "spatialite": {
        "ENGINE": "django_prometheus.db.backends.spatialite",
        "NAME": "db_spatialite.sqlite3",
    },
    # The following databases are used by test_db.py only
    "test_db_1": {
        "ENGINE": "django_prometheus.db.backends.sqlite3",
        "NAME": "test_db_1.sqlite3",
    },
    "test_db_2": {
        "ENGINE": "django_prometheus.db.backends.sqlite3",
        "NAME": "test_db_2.sqlite3",
    },
}

# Caches
_tmp_cache_dir = tempfile.mkdtemp()

CACHES = {
    "default": {
        "BACKEND": "django_prometheus.cache.backends.memcached.PyLibMCCache",
        "LOCATION": "localhost:11211",
    },
    "memcached.PyLibMCCache": {
        "BACKEND": "django_prometheus.cache.backends.memcached.PyLibMCCache",
        "LOCATION": "localhost:11211",
    },
    "memcached.PyMemcacheCache": {
        "BACKEND": "django_prometheus.cache.backends.memcached.PyMemcacheCache",
        "LOCATION": "localhost:11211",
    },
    "filebased": {
        "BACKEND": "django_prometheus.cache.backends.filebased.FileBasedCache",
        "LOCATION": os.path.join(_tmp_cache_dir, "django_cache"),
    },
    "locmem": {
        "BACKEND": "django_prometheus.cache.backends.locmem.LocMemCache",
        "LOCATION": os.path.join(_tmp_cache_dir, "locmem_cache"),
    },
    "native_redis": {
        "BACKEND": "django_prometheus.cache.backends.redis.NativeRedisCache",
        "LOCATION": "redis://127.0.0.1:6379/0",
    },
    "redis": {
        "BACKEND": "django_prometheus.cache.backends.redis.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379/1",
    },
    # Fake redis config emulated stopped service
    "stopped_redis": {
        "BACKEND": "django_prometheus.cache.backends.redis.RedisCache",
        "LOCATION": "redis://127.0.0.1:6666/1",
    },
    "stopped_redis_ignore_exception": {
        "BACKEND": "django_prometheus.cache.backends.redis.RedisCache",
        "LOCATION": "redis://127.0.0.1:6666/1",
        "OPTIONS": {"IGNORE_EXCEPTIONS": True},
    },
}


# Internationalization
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = False


# Static files (CSS, JavaScript, Images)
STATIC_URL = "/static/"

LOGGING = {
    "version": 1,
    "disable_existing_loggers": False,
    "handlers": {"console": {"class": "logging.StreamHandler"}},
    "root": {"handlers": ["console"], "level": "INFO"},
    "loggers": {"django": {"handlers": ["console"], "level": "INFO"}},
}