From 33b37ec63e99169760c51e523f7e1969b18e9c4a Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Mon, 18 Dec 2017 15:31:28 +0000 Subject: [PATCH] updated new deployment settings.py - updated django urls to point to the current version - renamed MIDDLEWARE_CLASSES to MIDDLEWARE, MIDDLEWARE_CLASSES is depreciated in django >= 1.10 - whitespace and #noqa fixes --- .../core/commands/templates/settings.py.tpl | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/modoboa/core/commands/templates/settings.py.tpl b/modoboa/core/commands/templates/settings.py.tpl index c61596c2e..af59cce7a 100644 --- a/modoboa/core/commands/templates/settings.py.tpl +++ b/modoboa/core/commands/templates/settings.py.tpl @@ -1,26 +1,31 @@ """ Django settings for {{ name }} project. +Generated by 'django-admin startproject' using Django 1.11.8. + For more information on this file, see -https://docs.djangoproject.com/en/1.6/topics/settings/ +https://docs.djangoproject.com/en/1.11/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.11/ref/settings/ """ -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os -from logging.handlers import SysLogHandler +from __future__ import unicode_literals +from logging.handlers import SysLogHandler +import os {% if devmode %} -from modoboa.core.dev_settings import * + +from modoboa.core.dev_settings import * # noqa {% endif %} + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.realpath(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.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '{{ secret_key }}' @@ -29,7 +34,7 @@ SECRET_KEY = '{{ secret_key }}' DEBUG = {{ devmode }} ALLOWED_HOSTS = [ - '{{ allowed_host }}' + '{{ allowed_host }}', ] SITE_ID = 1 @@ -76,7 +81,7 @@ INSTALLED_APPS += MODOBOA_APPS AUTH_USER_MODEL = 'core.User' -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'x_forwarded_for.middleware.XForwardedForMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -131,14 +136,14 @@ WSGI_APPLICATION = '{{ name }}.wsgi.application' # Database -# https://docs.djangoproject.com/en/1.6/ref/settings/#databases +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { {% for conn in db_connections.values %}{{ conn|safe }}{% endfor %} } # Internationalization -# https://docs.djangoproject.com/en/1.6/topics/i18n/ +# https://docs.djangoproject.com/en/1.11/topics/i18n/ LANGUAGE_CODE = '{{ lang }}' @@ -150,9 +155,8 @@ USE_L10N = True USE_TZ = True - # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.6/howto/static-files/ +# https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/sitestatic/' STATIC_ROOT = os.path.join(BASE_DIR, 'sitestatic') @@ -173,13 +177,14 @@ REST_FRAMEWORK = { } # Modoboa settings -#MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "custom_logo.png") +# MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "custom_logo.png") -#DOVECOT_LOOKUP_PATH = ('/path/to/dovecot', ) +# DOVECOT_LOOKUP_PATH = ('/path/to/dovecot', ) MODOBOA_API_URL = 'https://api.modoboa.org/1/' -# Password validation rules +# Password validation +# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -276,5 +281,5 @@ try: from {{ extension }} import settings as {{ extension }}_settings {{ extension }}_settings.apply(globals()) except AttributeError: - from {{ extension }}.settings import * + from {{ extension }}.settings import * # noqa {% endfor %}