From f409521498346841618f091a6701151666227beb Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 7 Mar 2015 12:09:28 +0100 Subject: [PATCH] Re-initialised MaMweb with DJ 1.7, backport settings --- mamweb/settings.py | 180 +++++++++++++++------------------------------ mamweb/urls.py | 6 +- mamweb/wsgi.py | 2 +- manage.py | 2 +- 4 files changed, 64 insertions(+), 126 deletions(-) diff --git a/mamweb/settings.py b/mamweb/settings.py index 2f4e1e0a..84c065a3 100644 --- a/mamweb/settings.py +++ b/mamweb/settings.py @@ -1,13 +1,11 @@ -import os -gettext = lambda s: s """ Django settings for mamweb project. For more information on this file, see -https://docs.djangoproject.com/en/1.6/topics/settings/ +https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.6/ref/settings/ +https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) @@ -16,10 +14,10 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'mj+$6#xw$a8l0!l$qk^mwm@&x+(!*vp5**8j*naxe5*0l_kjv*' +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 @@ -29,30 +27,32 @@ TEMPLATE_DEBUG = True ALLOWED_HOSTS = [] -# Application definition +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' -# Database -# https://docs.djangoproject.com/en/1.6/ref/settings/#databases - - - # Internationalization -# https://docs.djangoproject.com/en/1.6/topics/i18n/ +# https://docs.djangoproject.com/en/1.7/topics/i18n/ LANGUAGE_CODE = 'cs' TIME_ZONE = 'Europe/Prague' -USE_I18N = True +USE_I18N = False USE_L10N = True @@ -60,11 +60,7 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.6/howto/static-files/ - -MEDIA_TREE_MEDIA_BACKENDS = ( - 'media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend', -) +# https://docs.djangoproject.com/en/1.7/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' @@ -74,14 +70,12 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'mamweb', 'static'), ) -SITE_ID = 1 STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', ) - TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', @@ -90,17 +84,12 @@ TEMPLATE_LOADERS = ( MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.locale.LocaleMiddleware', - 'django.middleware.doc.XViewMiddleware', - 'django.middleware.common.CommonMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'cms.middleware.user.CurrentUserMiddleware', - 'cms.middleware.page.CurrentPageMiddleware', - 'cms.middleware.toolbar.ToolbarMiddleware', - 'cms.middleware.language.LanguageCookieMiddleware' ) TEMPLATE_CONTEXT_PROCESSORS = ( @@ -114,115 +103,66 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.tz', 'sekizai.context_processors.sekizai', 'django.core.context_processors.static', - 'cms.context_processors.cms_settings' + 'cms.context_processors.cms_settings', + 'allauth.account.context_processors.account', + 'allauth.socialaccount.context_processors.socialaccount', ) -TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, 'mamweb', 'templates'), -) INSTALLED_APPS = ( -# 'grappelli', -# 'djangocms_admin_style', -# 'suit', - - 'djangocms_text_ckeditor', + 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', - 'django.contrib.admin', - 'django.contrib.sites', - 'django.contrib.sitemaps', - 'django.contrib.staticfiles', 'django.contrib.messages', - 'cms', - 'mptt', - 'menus', - 'south', - 'sekizai', + 'django.contrib.staticfiles', -# 'filer', -# 'easy_thumbnails', - -# 'media_tree', -# 'media_tree.contrib.cms_plugins', -# 'media_tree.contrib.cms_plugins.media_tree_listing', -# 'media_tree.contrib.cms_plugins.media_tree_image', -# 'media_tree.contrib.cms_plugins.media_tree_slideshow', -# 'media_tree.contrib.cms_plugins.media_tree_gallery', -# 'media_tree.contrib.media_extensions.images.focal_point', -# 'media_tree.contrib.media_extensions.zipfiles', - - -# 'cmsplugin_filer_file', -# 'cmsplugin_filer_folder', -# 'cmsplugin_filer_link', -# 'cmsplugin_filer_image', -# 'cmsplugin_filer_teaser', -# 'cmsplugin_filer_video', - -# 'djangocms_style', -# 'djangocms_column', -# 'djangocms_file', -# 'djangocms_flash', -# 'djangocms_googlemap', -# 'djangocms_inherit', -# 'djangocms_link', -# 'djangocms_picture', -# 'djangocms_teaser', -# 'djangocms_video', + 'sekizai', 'reversion', - 'mamweb' -) - -LANGUAGES = ( - ## Customize this - ('cs', gettext('cs')), - ('en', gettext('en')), -) -CMS_LANGUAGES = { - ## Customize this - 'default': { - 'public': True, - 'hide_untranslated': False, - 'redirect_on_fallback': True, - }, - 1: [ - { - 'public': True, - 'code': 'cs', - 'hide_untranslated': False, - 'name': gettext('cs'), - 'redirect_on_fallback': True, - }, - { - 'public': True, - 'code': 'en', - 'hide_untranslated': False, - 'name': gettext('en'), - 'redirect_on_fallback': True, - }, - ], -} + 'allauth', + 'allauth.account', + 'allauth.socialaccount', +# 'allauth.socialaccount.providers.facebook', +# 'allauth.socialaccount.providers.openid', + 'allauth.socialaccount.providers.google', -CMS_TEMPLATES = ( - ## Customize this - ('page.html', 'Page'), - ('feature.html', 'Page with Feature') + 'mamweb', + 'seminar', ) -CMS_PERMISSION = True - -CMS_PLACEHOLDER_CONF = {} +# Database +# https://docs.djangoproject.com/en/1.7/ref/settings/#databases DATABASES = { - 'default': - {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'project.db', 'HOST': 'localhost', 'USER': '', 'PASSWORD': '', 'PORT': ''} + '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'), + } } -SOUTH_MIGRATION_MODULES = { - 'reversion': 'reversion.south_migrations', - 'easy_thumbnails': 'easy_thumbnails.south_migrations', +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' \ No newline at end of file diff --git a/mamweb/urls.py b/mamweb/urls.py index dd274c6c..18a20203 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -3,14 +3,12 @@ from django.conf.urls.i18n import i18n_patterns from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from django.conf import settings -from cms.sitemaps import CMSSitemap - -admin.autodiscover() urlpatterns = i18n_patterns('', url(r'^admin/', include(admin.site.urls)), # NOQA - url(r'^', include('cms.urls')), + url(r'^accounts/', include('allauth.urls')), + url(r'^', include('seminar.urls')), ) # This is only needed when using runserver. diff --git a/mamweb/wsgi.py b/mamweb/wsgi.py index f1604f03..d46807d8 100644 --- a/mamweb/wsgi.py +++ b/mamweb/wsgi.py @@ -4,7 +4,7 @@ WSGI config for mamweb project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see -https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ +https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os diff --git a/manage.py b/manage.py index 24eeef69..ccdb032b 100755 --- a/manage.py +++ b/manage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!bin/python import os import sys