From cacc5e4c87a966bed8bcd5692e0532e33c18ce99 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 14 Mar 2015 14:53:49 +0100 Subject: [PATCH] Update / refresh settings --- mamweb/settings.py | 21 ++++++++++ mamweb/settings_common.py | 88 ++++----------------------------------- mamweb/settings_prod.py | 27 +++++++++++- mamweb/settings_test.py | 23 +++++++++- 4 files changed, 77 insertions(+), 82 deletions(-) diff --git a/mamweb/settings.py b/mamweb/settings.py index 0965dcd2..368ca53c 100644 --- a/mamweb/settings.py +++ b/mamweb/settings.py @@ -2,10 +2,31 @@ from .settings_common import * # Local development settings +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ + INSTALLED_APPS += ( 'debug_toolbar', 'django_extensions', ) +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +TEMPLATE_DEBUG = True + +ALLOWED_HOSTS = ['127.0.0.1'] + +# Database +# https://docs.djangoproject.com/en/1.7/ref/settings/#databases +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db-local.sqlite3'), + } +} diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 4e622f6f..b5f8b3b9 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -12,53 +12,21 @@ https://docs.djangoproject.com/en/1.7/ref/settings/ import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -TEMPLATE_DEBUG = True - -ALLOWED_HOSTS = [] - - -AUTHENTICATION_BACKENDS = ( - # Needed to login by username in Django admin, regardless of `allauth` - 'django.contrib.auth.backends.ModelBackend', - # `allauth` specific authentication methods, such as login by e-mail - 'allauth.account.auth_backends.AuthenticationBackend', -) - - - # Application definition SITE_ID = 1 - ROOT_URLCONF = 'mamweb.urls' - WSGI_APPLICATION = 'mamweb.wsgi.application' - # Internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ LANGUAGE_CODE = 'cs' - TIME_ZONE = 'Europe/Prague' - USE_I18N = False - USE_L10N = True - USE_TZ = True - # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.7/howto/static-files/ @@ -67,15 +35,17 @@ MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') STATIC_ROOT = os.path.join(BASE_DIR, 'static') -STATICFILES_DIRS = ( - os.path.join(BASE_DIR, 'mamweb', 'static'), -) - STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', ) +# Modules configuration + +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', +) + TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', @@ -103,11 +73,8 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.tz', 'sekizai.context_processors.sekizai', 'django.core.context_processors.static', - 'allauth.account.context_processors.account', - 'allauth.socialaccount.context_processors.socialaccount', ) - INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', @@ -120,52 +87,13 @@ INSTALLED_APPS = ( 'sekizai', 'reversion', - 'allauth', - 'allauth.account', - 'allauth.socialaccount', -# 'allauth.socialaccount.providers.facebook', -# 'allauth.socialaccount.providers.openid', - 'allauth.socialaccount.providers.google', - - 'mamweb', 'seminar', ) -# Database -# https://docs.djangoproject.com/en/1.7/ref/settings/#databases - -DATABASES = { - 'default': { -# 'ENGINE': 'django.db.backends.postgresql_psycopg2', -# 'NAME': 'mam', -# 'USER': 'mam', -# }, -# 'test': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} - - -SOCIALACCOUNT_QUERY_EMAIL = True -SOCIALACCOUNT_PROVIDERS = { - 'google': { - 'SCOPE': ['profile', 'email'], - 'AUTH_PARAMS': { 'access_type': 'online' } - }, - 'facebook': { - 'SCOPE': ['email', 'publish_stream'], - 'METHOD': 'js_sdk', - 'VERIFIED_EMAIL': True, - } -} -ACCOUNT_AUTHENTICATION_METHOD = 'username_email' -ACCOUNT_EMAIL_REQUIRED = True -SOCIALACCOUNT_EMAIL_REQUIRED = True - # MaM specific -SEMINAR_RESENI_DIRNAME = 'reseni' +SEMINAR_RESENI_DIR = os.path.join(BASE_DIR, 'media', 'reseni') + diff --git a/mamweb/settings_prod.py b/mamweb/settings_prod.py index ffabab1a..259ad107 100644 --- a/mamweb/settings_prod.py +++ b/mamweb/settings_prod.py @@ -1,5 +1,30 @@ from .settings_common import * # Specific settings for remote production -# ... + +# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ + +INSTALLED_APPS += ( + ) + +# SECURITY WARNING: keep the secret key used in production secret! +#SECRET_KEY = TODO + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = False + +TEMPLATE_DEBUG = False + +ALLOWED_HOSTS = ['mam.mff.cuni.cz'] + +# Database +# https://docs.djangoproject.com/en/1.7/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'mamweb', + 'USER': 'mamweb', + }, +} diff --git a/mamweb/settings_test.py b/mamweb/settings_test.py index 69dcc8ea..95ef435d 100644 --- a/mamweb/settings_test.py +++ b/mamweb/settings_test.py @@ -1,13 +1,34 @@ from .settings_common import * # Specific settings for remote test site -# ... + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ INSTALLED_APPS += ( 'debug_toolbar', 'django_extensions', ) +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +TEMPLATE_DEBUG = True + +ALLOWED_HOSTS = ['test.mam.mff.cuni.cz'] + +# Database +# https://docs.djangoproject.com/en/1.7/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db-test.sqlite3'), + } +}