-
Notifications
You must be signed in to change notification settings - Fork 335
/
manage.py
executable file
·66 lines (61 loc) · 1.81 KB
/
manage.py
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
#!/usr/bin/env python
"""
manage.py script used by django-mailer developers to create
DB migrations or test management commands.
"""
import os
from copy import deepcopy
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"mailer",
],
DATABASES={
"default": (
{
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "mailer",
"USER": "mailer",
"PASSWORD": "mailer",
"PORT": 5432,
"HOST": "localhost",
"CONN_MAX_AGE": 30,
}
if "MAILER_USE_POSTGRES" in os.environ
else {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "test",
}
)
},
SITE_ID=1,
SECRET_KEY="notasecret",
MAILER_EMPTY_QUEUE_SLEEP=10,
# MAILER_EMAIL_THROTTLE=10,
EMAIL_BACKEND="mailer.backend.DbBackend",
MAILER_EMAIL_BACKEND="django.core.mail.backends.console.EmailBackend",
)
if __name__ == "__main__":
from django.conf import settings
from django.core import management
from django.utils.log import DEFAULT_LOGGING
LOGGING = deepcopy(DEFAULT_LOGGING)
# For testing runmailer_pg:
LOGGING["handlers"]["mailer.runmail"] = {
"level": "INFO",
"class": "logging.StreamHandler",
"formatter": "django.server",
}
LOGGING["loggers"]["mailer.postgres"] = {
"handlers": ["mailer.runmail"],
"level": "INFO",
}
LOGGING["loggers"]["mailer.engine"] = {
"handlers": ["mailer.runmail"],
"level": "INFO",
}
DEFAULT_SETTINGS["LOGGING"] = LOGGING
settings.configure(**DEFAULT_SETTINGS)
management.execute_from_command_line()