Update project to work with Django 1.10.x

This commit is contained in:
Roberto Rosario
2016-12-22 02:51:28 -04:00
parent 1e194e04fa
commit 5662b56714
9 changed files with 85 additions and 41 deletions

View File

@@ -11,7 +11,7 @@
the user links the user links
- New Dashboard view - New Dashboard view
- Moved licenses to their own module in every app - Moved licenses to their own module in every app
- Update project to work with Django 1.9.11 - Update project to work with Django 1.10.4.
- Tags are alphabetically ordered by label (GitLab #342). - Tags are alphabetically ordered by label (GitLab #342).
- Stop loading theme fonts from the web (GitLab #343). - Stop loading theme fonts from the web (GitLab #343).
- Add support for attaching multiple tags (GitLab #307). - Add support for attaching multiple tags (GitLab #307).

View File

@@ -21,7 +21,7 @@ Other changes
the user links the user links
- Dashboard - Dashboard
- Moved licenses to their own module in every app - Moved licenses to their own module in every app
- Update project to work with Django 1.9.11 - Update project to work with Django 1.10.4
- Tags are alphabetically ordered by label - Tags are alphabetically ordered by label
- Stop loading theme fonts from the web - Stop loading theme fonts from the web
- Add support for attaching multiple tags to single or multiple documents. - Add support for attaching multiple tags to single or multiple documents.

View File

@@ -4,7 +4,20 @@ import sys
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mayan.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mayan.settings")
try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)

View File

@@ -111,7 +111,7 @@ class FilterForm(forms.Form):
class LicenseForm(FileDisplayForm): class LicenseForm(FileDisplayForm):
DIRECTORY = ('mayan',) DIRECTORY = ()
FILENAME = 'LICENSE' FILENAME = 'LICENSE'

View File

@@ -16,7 +16,7 @@ class Command(management.BaseCommand):
return get_random_string(50, chars) return get_random_string(50, chars)
def handle(self, *args, **options): def handle(self, *args, **options):
path = os.path.join(settings.BASE_DIR, 'mayan', 'settings', 'local.py') path = os.path.join(settings.BASE_DIR, 'settings', 'local.py')
if os.path.exists(path): if os.path.exists(path):
self.stdout.write(self.style.NOTICE('Existing settings file at: {0}. Backup, remove this file, and try again.'.format(path))) self.stdout.write(self.style.NOTICE('Existing settings file at: {0}. Backup, remove this file, and try again.'.format(path)))
else: else:

View File

@@ -1,15 +1,17 @@
""" """
Django settings for Mayan EDMS project. Django settings for mayan10 project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/ https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see 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.10/ref/settings/
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os import os
import sys import sys
@@ -17,14 +19,12 @@ from django.utils.translation import ugettext_lazy as _
import mayan import mayan
_file_path = os.path.abspath(os.path.dirname(__file__)).split('/') # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = '/'.join(_file_path[0:-2]) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = os.path.join(BASE_DIR, 'mayan', 'media')
# Quick-start development settings - unsuitable for production # 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.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'secret_key_missing' SECRET_KEY = 'secret_key_missing'
@@ -103,6 +103,7 @@ INSTALLED_APPS = (
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware', 'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@@ -118,10 +119,32 @@ MIDDLEWARE_CLASSES = (
ROOT_URLCONF = 'mayan.urls' ROOT_URLCONF = 'mayan.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
]
},
},
]
WSGI_APPLICATION = 'mayan.wsgi.application' WSGI_APPLICATION = 'mayan.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases # https://docs.djangoproject.com/en/1.10/ref/settings/#databases
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DATABASES = { DATABASES = {
'default': { 'default': {
@@ -130,8 +153,26 @@ DATABASES = {
} }
} }
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/ # https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
@@ -143,12 +184,13 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
STATIC_URL = '/static/' # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATIC_URL = '/static/'
# ------------ Custom settings section ---------- # ------------ Custom settings section ----------
TEMPLATE_DEBUG = True
PROJECT_TITLE = mayan.__title__ PROJECT_TITLE = mayan.__title__
PROJECT_WEBSITE = 'http://www.mayan-edms.com' PROJECT_WEBSITE = 'http://www.mayan-edms.com'
PROJECT_COPYRIGHT = mayan.__copyright__ PROJECT_COPYRIGHT = mayan.__copyright__
@@ -182,24 +224,10 @@ LANGUAGES = (
SITE_ID = 1 SITE_ID = 1
sys.path.append(os.path.join(BASE_DIR, 'mayan', 'apps')) sys.path.append(os.path.join(BASE_DIR, 'apps'))
STATIC_ROOT = os.path.join(MEDIA_ROOT, 'static') STATIC_ROOT = os.path.join(MEDIA_ROOT, 'static')
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
)
STATICFILES_FINDERS = ( STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',

View File

@@ -8,11 +8,11 @@ DEBUG = False
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
TEMPLATE_LOADERS = ( TEMPLATES['OPTIONS']['loaders'] = (
('django.template.loaders.cached.Loader', ( 'django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',
)), )
) )
CELERY_ALWAYS_EAGER = False CELERY_ALWAYS_EAGER = False

View File

@@ -4,11 +4,14 @@ WSGI config for mayan project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
""" """
import os import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mayan.settings.production")
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mayan.settings.production")
application = get_wsgi_application() application = get_wsgi_application()

View File

@@ -1,2 +1,2 @@
-r base.txt -r base.txt
Django==1.9.11 Django==1.10.4