allauth settings added to production

This commit is contained in:
Benni Bärmann 2021-05-11 12:22:04 +02:00
parent e4207af2ef
commit 9854e42e9a
1 changed files with 24 additions and 7 deletions

View File

@ -25,9 +25,6 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = '10.0.6.25' EMAIL_HOST = '10.0.6.25'
EMAIL_PORT = '25' EMAIL_PORT = '25'
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# get secrets # get secrets
with open(os.path.join(BASE_DIR, 'secrets.json')) as secrets_file: with open(os.path.join(BASE_DIR, 'secrets.json')) as secrets_file:
secrets = json.load(secrets_file) secrets = json.load(secrets_file)
@ -47,7 +44,7 @@ def get_secret(setting, secrets=secrets):
SECRET_KEY = get_secret('SECRET_KEY') SECRET_KEY = get_secret('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = True
# send mails only to debug mode adress even if in production # send mails only to debug mode adress even if in production
MAILTEST = True MAILTEST = True
@ -55,9 +52,6 @@ MAILTEST = True
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul'
STATIC_ROOT = BASE_DIR / 'staticfiles' STATIC_ROOT = BASE_DIR / 'staticfiles'
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
@ -73,6 +67,11 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.nextcloud',
'multiselectfield', 'multiselectfield',
'formtools', 'formtools',
] ]
@ -157,3 +156,21 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.1/howto/static-files/ # https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
# settings needed for allauth
SOCIALACCOUNT_PROVIDERS = {
'nextcloud': {
'SERVER': 'https://wolke.wikimedia.de/',
}
}
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend",
)
SITE_ID = 1
ACCOUNT_EMAIL_VERIFICATION = 'none'
LOGIN_REDIRECT_URL = 'home'