Skip to content

Commit b1f03d6

Browse files
Use LANGPRO_CONTAINER env var in common_settings.py
1 parent 044eee3 commit b1f03d6

1 file changed

Lines changed: 110 additions & 107 deletions

File tree

Lines changed: 110 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,110 @@
1-
INSTALLED_APPS = [
2-
"django.contrib.admin",
3-
"django.contrib.auth",
4-
"django.contrib.contenttypes",
5-
"django.contrib.sessions",
6-
"django.contrib.messages",
7-
"livereload",
8-
"django.contrib.staticfiles",
9-
"rest_framework",
10-
"django.contrib.sites",
11-
"rest_framework.authtoken",
12-
"dj_rest_auth",
13-
"dj_rest_auth.registration",
14-
"allauth",
15-
"allauth.account",
16-
# Required for deleting accounts, but not actually used,
17-
# cf. https://github.com/iMerica/dj-rest-auth/pull/110.
18-
"allauth.socialaccount",
19-
"user",
20-
"revproxy",
21-
"problem",
22-
"annotation",
23-
]
24-
25-
MIDDLEWARE = [
26-
"django.middleware.security.SecurityMiddleware",
27-
"django.contrib.sessions.middleware.SessionMiddleware",
28-
"django.middleware.locale.LocaleMiddleware",
29-
"django.middleware.common.CommonMiddleware",
30-
"django.middleware.csrf.CsrfViewMiddleware",
31-
"django.contrib.auth.middleware.AuthenticationMiddleware",
32-
"django.contrib.messages.middleware.MessageMiddleware",
33-
"django.middleware.clickjacking.XFrameOptionsMiddleware",
34-
"allauth.account.middleware.AccountMiddleware",
35-
]
36-
37-
# Internationalization
38-
# https://docs.djangoproject.com/en/3.0/topics/i18n/
39-
LANGUAGES = [
40-
("en", "English"),
41-
("nl", "Nederlands"),
42-
]
43-
LANGUAGE_CODE = "en"
44-
45-
TIME_ZONE = "Europe/Amsterdam"
46-
47-
USE_I18N = True
48-
49-
USE_TZ = True # Authentication
50-
REST_FRAMEWORK = {
51-
"DEFAULT_AUTHENTICATION_CLASSES": [
52-
"rest_framework.authentication.TokenAuthentication",
53-
"rest_framework.authentication.SessionAuthentication",
54-
]
55-
}
56-
57-
AUTH_USER_MODEL = "user.User"
58-
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
59-
ACCOUNT_SIGNUP_FIELDS = ["email*", "username*", "password1*", "password2*"]
60-
61-
SITE_ID = 1
62-
SITE_NAME = "langpro_annotator"
63-
64-
# Remove this setting in production!
65-
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
66-
67-
HOST = "localhost:8000"
68-
69-
REST_AUTH = {
70-
"USER_DETAILS_SERIALIZER": "user.serializers.CustomUserDetailsSerializer",
71-
}
72-
73-
LOGGING = {
74-
"version": 1,
75-
"disable_existing_loggers": False,
76-
"formatters": {
77-
"verbose": {
78-
"format": "{levelname} {asctime} {module} {message}",
79-
"style": "{",
80-
},
81-
"simple": {
82-
"format": "{levelname} {message}",
83-
"style": "{",
84-
},
85-
},
86-
"handlers": {
87-
"console": {
88-
"level": "INFO",
89-
"class": "logging.StreamHandler",
90-
"formatter": "simple",
91-
},
92-
},
93-
"loggers": {
94-
"django": {
95-
"handlers": ["console"],
96-
"level": "INFO",
97-
"propagate": False,
98-
},
99-
"LangProAnnotator": {
100-
"handlers": ["console"],
101-
"level": "INFO",
102-
"propagate": False,
103-
},
104-
},
105-
}
106-
107-
LANGPRO_URL = "http://localhost:8080"
1+
import os
2+
3+
4+
INSTALLED_APPS = [
5+
"django.contrib.admin",
6+
"django.contrib.auth",
7+
"django.contrib.contenttypes",
8+
"django.contrib.sessions",
9+
"django.contrib.messages",
10+
"livereload",
11+
"django.contrib.staticfiles",
12+
"rest_framework",
13+
"django.contrib.sites",
14+
"rest_framework.authtoken",
15+
"dj_rest_auth",
16+
"dj_rest_auth.registration",
17+
"allauth",
18+
"allauth.account",
19+
# Required for deleting accounts, but not actually used,
20+
# cf. https://github.com/iMerica/dj-rest-auth/pull/110.
21+
"allauth.socialaccount",
22+
"user",
23+
"revproxy",
24+
"problem",
25+
"annotation",
26+
]
27+
28+
MIDDLEWARE = [
29+
"django.middleware.security.SecurityMiddleware",
30+
"django.contrib.sessions.middleware.SessionMiddleware",
31+
"django.middleware.locale.LocaleMiddleware",
32+
"django.middleware.common.CommonMiddleware",
33+
"django.middleware.csrf.CsrfViewMiddleware",
34+
"django.contrib.auth.middleware.AuthenticationMiddleware",
35+
"django.contrib.messages.middleware.MessageMiddleware",
36+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
37+
"allauth.account.middleware.AccountMiddleware",
38+
]
39+
40+
# Internationalization
41+
# https://docs.djangoproject.com/en/3.0/topics/i18n/
42+
LANGUAGES = [
43+
("en", "English"),
44+
("nl", "Nederlands"),
45+
]
46+
LANGUAGE_CODE = "en"
47+
48+
TIME_ZONE = "Europe/Amsterdam"
49+
50+
USE_I18N = True
51+
52+
USE_TZ = True # Authentication
53+
REST_FRAMEWORK = {
54+
"DEFAULT_AUTHENTICATION_CLASSES": [
55+
"rest_framework.authentication.TokenAuthentication",
56+
"rest_framework.authentication.SessionAuthentication",
57+
]
58+
}
59+
60+
AUTH_USER_MODEL = "user.User"
61+
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
62+
ACCOUNT_SIGNUP_FIELDS = ["email*", "username*", "password1*", "password2*"]
63+
64+
SITE_ID = 1
65+
SITE_NAME = "langpro_annotator"
66+
67+
# Remove this setting in production!
68+
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
69+
70+
HOST = "localhost:8000"
71+
72+
REST_AUTH = {
73+
"USER_DETAILS_SERIALIZER": "user.serializers.CustomUserDetailsSerializer",
74+
}
75+
76+
LOGGING = {
77+
"version": 1,
78+
"disable_existing_loggers": False,
79+
"formatters": {
80+
"verbose": {
81+
"format": "{levelname} {asctime} {module} {message}",
82+
"style": "{",
83+
},
84+
"simple": {
85+
"format": "{levelname} {message}",
86+
"style": "{",
87+
},
88+
},
89+
"handlers": {
90+
"console": {
91+
"level": "INFO",
92+
"class": "logging.StreamHandler",
93+
"formatter": "simple",
94+
},
95+
},
96+
"loggers": {
97+
"django": {
98+
"handlers": ["console"],
99+
"level": "INFO",
100+
"propagate": False,
101+
},
102+
"LangProAnnotator": {
103+
"handlers": ["console"],
104+
"level": "INFO",
105+
"propagate": False,
106+
},
107+
},
108+
}
109+
110+
LANGPRO_URL = os.environ.get('LANGPRO_CONTAINER') or 'http://localhost:8080'

0 commit comments

Comments
 (0)