diff options
Diffstat (limited to 'example_project')
| -rw-r--r-- | example_project/settings.py | 101 |
1 files changed, 89 insertions, 12 deletions
diff --git a/example_project/settings.py b/example_project/settings.py index f373e8c..7bc1d8d 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -32,7 +32,6 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.abspath(__file__)) - # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ @@ -71,14 +70,14 @@ INSTALLED_APPS = [ 'allauth', 'allauth.account', 'allauth.socialaccount', - 'allauth.socialaccount.providers.openid', - 'django_mailman3.lib.auth.fedora', - 'allauth.socialaccount.providers.github', - 'allauth.socialaccount.providers.gitlab', - 'allauth.socialaccount.providers.google', + # 'allauth.socialaccount.providers.openid', + # 'django_mailman3.lib.auth.fedora', + # 'allauth.socialaccount.providers.github', + # 'allauth.socialaccount.providers.gitlab', + # 'allauth.socialaccount.providers.google', # 'allauth.socialaccount.providers.facebook', - 'allauth.socialaccount.providers.twitter', - 'allauth.socialaccount.providers.stackexchange', + # 'allauth.socialaccount.providers.twitter', + # 'allauth.socialaccount.providers.stackexchange', ] MIDDLEWARE = [ @@ -117,7 +116,6 @@ TEMPLATES = [ WSGI_APPLICATION = 'wsgi.application' - # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases @@ -128,6 +126,47 @@ DATABASES = { } } +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'allauth.account.auth_backends.AuthenticationBackend', +) + +# Django Allauth +ACCOUNT_AUTHENTICATION_METHOD = "username_email" +ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_VERIFICATION = "mandatory" +ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" +ACCOUNT_UNIQUE_EMAIL = True + +SOCIALACCOUNT_PROVIDERS = { + 'openid': { + 'SERVERS': [ + dict(id='yahoo', + name='Yahoo', + openid_url='http://me.yahoo.com'), + ], + }, + 'google': { + 'SCOPE': ['profile', 'email'], + 'AUTH_PARAMS': {'access_type': 'online'}, + }, + 'facebook': { + 'METHOD': 'oauth2', + 'SCOPE': ['email'], + 'FIELDS': [ + 'email', + 'name', + 'first_name', + 'last_name', + 'locale', + 'timezone', + ], + 'VERSION': 'v2.4', + }, +} + +# Change this when you have a real email backend +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators @@ -148,10 +187,9 @@ AUTH_PASSWORD_VALIDATORS = [ ] LOGIN_URL = 'account_login' -LOGIN_REDIRECT_URL = 'list_index' +LOGIN_REDIRECT_URL = 'pgp_list_index' LOGOUT_URL = 'account_logout' - # Internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/ @@ -165,7 +203,6 @@ USE_L10N = True USE_TZ = True - # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. @@ -175,3 +212,43 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static') # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'console': { + 'class': 'logging.StreamHandler', + 'formatter': 'simple', + }, + 'file': { + 'level': 'INFO', + # 'class': 'logging.handlers.RotatingFileHandler', + 'class': 'logging.handlers.WatchedFileHandler', + 'filename': os.path.join(BASE_DIR, 'logs', 'postorius.log'), + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'django': { + 'handlers': ['console', 'file'], + 'level': 'INFO', + }, + 'django.request': { + 'handlers': ['console', 'file'], + 'level': 'ERROR', + }, + 'postorius': { + 'handlers': ['console', 'file'], + 'level': 'INFO', + }, + }, + 'formatters': { + 'simple': { + 'format': '%(levelname)s: %(message)s' + }, + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s' + }, + }, +} |
