From 0ef00b508243416d99815e9052ce459d6ab5f02e Mon Sep 17 00:00:00 2001 From: pwhipp Date: Thu, 10 Jul 2014 15:59:03 +1000 Subject: [PATCH] Reverted to default (sqlite) settings so all working. --- .../includes/common.py => settings.py} | 121 +++++++++++++----- mayan/settings/__init__.py | 1 - mayan/settings/dev.py | 30 ----- mayan/settings/includes/.gitignore | 1 - mayan/settings/includes/__init__.py | 1 - mayan/settings/includes/secrets.py.example | 3 - mayan/settings/production.py | 15 --- 7 files changed, 89 insertions(+), 83 deletions(-) rename mayan/{settings/includes/common.py => settings.py} (73%) delete mode 100644 mayan/settings/__init__.py delete mode 100644 mayan/settings/dev.py delete mode 100644 mayan/settings/includes/.gitignore delete mode 100644 mayan/settings/includes/__init__.py delete mode 100644 mayan/settings/includes/secrets.py.example delete mode 100644 mayan/settings/production.py diff --git a/mayan/settings/includes/common.py b/mayan/settings.py similarity index 73% rename from mayan/settings/includes/common.py rename to mayan/settings.py index ed70d069e8..eb4a3386c1 100644 --- a/mayan/settings/includes/common.py +++ b/mayan/settings.py @@ -1,4 +1,6 @@ """ +Django settings for testproject project. + For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ @@ -6,38 +8,33 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ - -from django.core.exceptions import ImproperlyConfigured - +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os ugettext = lambda s: s -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os -import sys +BASE_DIR = os.path.abspath(os.path.dirname(__file__)) +SITE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -BASE_DIR = '/'.join(os.path.abspath(os.path.dirname(__file__)).split('/')[0:-3]) # up from mayan/settings/include -SITE_ROOT = BASE_DIR # for compatibility -_apps_path = os.path.join(BASE_DIR, 'mayan/apps') -if _apps_path not in sys.path: - sys.path.append(_apps_path) +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ -STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, 'static_collected/') +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'om^a(i8^6&h+umbd2%pt91cj!qu_@oztw117rgxmn(n2lp^*c!' -try: - from .secrets import * -except ImportError: - raise ImproperlyConfigured('You need a secrets.py file - contact aaron.dennis@crossculturalconsult.com') +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +TEMPLATE_DEBUG = True + +ALLOWED_HOSTS = [] -DEBUG = False -TEMPLATE_DEBUG = DEBUG # Application definition INSTALLED_APPS = ( - #Django +#Django 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -47,16 +44,16 @@ INSTALLED_APPS = ( 'django.contrib.admindocs', 'django.contrib.comments', 'django.contrib.staticfiles', - # 3rd party - # South +# 3rd party +# South 'south', - # Others +# Others 'filetransfers', 'taggit', 'mptt', 'compressor', 'rest_framework', - # Base generic +# Base generic 'permissions', 'project_setup', 'project_tools', @@ -64,8 +61,8 @@ INSTALLED_APPS = ( 'navigation', 'lock_manager', 'web_theme', - # pagination needs to go after web_theme so that the pagination template - # if found +# pagination needs to go after web_theme so that the pagination template +# if found 'pagination', 'common', 'django_gpg', @@ -77,7 +74,7 @@ INSTALLED_APPS = ( 'scheduler', 'job_processor', 'installation', - # Mayan EDMS +# Mayan EDMS 'storage', 'app_registry', 'folders', @@ -98,8 +95,9 @@ INSTALLED_APPS = ( 'checkouts', 'bootstrap', 'registration', - # Has to be last so the other apps can register it's signals - 'signaler') +# Has to be last so the other apps can register it's signals + 'signaler', +) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', @@ -112,13 +110,22 @@ MIDDLEWARE_CLASSES = ( 'common.middleware.strip_spaces_widdleware.SpacelessMiddleware', 'common.middleware.login_required_middleware.LoginRequiredMiddleware', 'permissions.middleware.permission_denied_middleware.PermissionDeniedMiddleware', - 'pagination.middleware.PaginationMiddleware') + 'pagination.middleware.PaginationMiddleware', +) ROOT_URLCONF = 'mayan.urls' WSGI_APPLICATION = 'mayan.wsgi.application' +# Database +# https://docs.djangoproject.com/en/1.6/ref/settings/#databases +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(SITE_ROOT, 'db.sqlite3'), + } +} # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ @@ -137,10 +144,18 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ +STATIC_URL = '/static/' + +# Custom settings section + +import sys from django.core.urlresolvers import reverse_lazy -PROJECT_TITLE = 'Mayan CCCS Review' +sys.path.append(os.path.join(BASE_DIR, 'apps')) + +PROJECT_TITLE = 'Mayan EDMS' +PROJECT_NAME = 'mayan' LANGUAGES = ( ('ar', ugettext('Arabic')), @@ -169,6 +184,9 @@ LANGUAGES = ( SITE_ID = 1 +STATIC_ROOT = os.path.join(SITE_ROOT, 'static/') + +STATIC_URL = '/%s-static/' % PROJECT_NAME ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/' @@ -218,7 +236,7 @@ LOGIN_EXEMPT_URLS = ( r'^favicon\.ico$', r'^about\.html$', r'^legal/', # allow the entire /legal/* subsection - r'^static/', + r'^%s-static/' % PROJECT_NAME, r'^accounts/register/$', r'^accounts/register/complete/$', @@ -250,3 +268,42 @@ REST_FRAMEWORK = { 'PAGINATE_BY_PARAM': 'page_size', 'MAX_PAGINATE_BY': 100, } + +try: + from settings_local import * +except ImportError: + pass + +if DEBUG: + INTERNAL_IPS = ('127.0.0.1',) + + TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ) + try: + import rosetta + INSTALLED_APPS += ('rosetta',) + except ImportError: + pass + + try: + import django_extensions + INSTALLED_APPS += ('django_extensions',) + except ImportError: + pass + + try: + import debug_toolbar + #INSTALLED_APPS +=('debug_toolbar',) + except ImportError: + pass + + TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.debug',) + + WSGI_AUTO_RELOAD = True + if 'debug_toolbar' in INSTALLED_APPS: + MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) + DEBUG_TOOLBAR_CONFIG = { + 'INTERCEPT_REDIRECTS': False, + } diff --git a/mayan/settings/__init__.py b/mayan/settings/__init__.py deleted file mode 100644 index 62bff48960..0000000000 --- a/mayan/settings/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'paul' diff --git a/mayan/settings/dev.py b/mayan/settings/dev.py deleted file mode 100644 index bd6090bdff..0000000000 --- a/mayan/settings/dev.py +++ /dev/null @@ -1,30 +0,0 @@ -from mayan.settings.includes.common import * - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -INTERNAL_IPS = ('127.0.0.1',) - -ALLOWED_HOSTS = [] - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'mayan', - 'USER': 'mayan', - 'PASSWORD': DBPASSWORD, - 'HOST': '', - 'PORT': ''}} - -INSTALLED_APPS = INSTALLED_APPS + ( - 'rosetta', - 'django_extensions', - 'debug_toolbar') - - -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader') -TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.debug',) -WSGI_AUTO_RELOAD = True -MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) diff --git a/mayan/settings/includes/.gitignore b/mayan/settings/includes/.gitignore deleted file mode 100644 index c6b649876c..0000000000 --- a/mayan/settings/includes/.gitignore +++ /dev/null @@ -1 +0,0 @@ -secrets.py \ No newline at end of file diff --git a/mayan/settings/includes/__init__.py b/mayan/settings/includes/__init__.py deleted file mode 100644 index 62bff48960..0000000000 --- a/mayan/settings/includes/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'paul' diff --git a/mayan/settings/includes/secrets.py.example b/mayan/settings/includes/secrets.py.example deleted file mode 100644 index d6e1bc581b..0000000000 --- a/mayan/settings/includes/secrets.py.example +++ /dev/null @@ -1,3 +0,0 @@ -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'not so secret so change me' -DBPASSWORD = 'my db user password' \ No newline at end of file diff --git a/mayan/settings/production.py b/mayan/settings/production.py deleted file mode 100644 index 6f4a2fbd03..0000000000 --- a/mayan/settings/production.py +++ /dev/null @@ -1,15 +0,0 @@ -from mayan.settings.includes.common import * - -DEBUG = False -TEMPLATE_DEBUG = DEBUG - -ALLOWED_HOSTS = ['.crossculturalconsult.com'] - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'mayan', - 'USER': 'mayan', - 'PASSWORD': DBPASSWORD, - 'HOST': '', - 'PORT': ''}} \ No newline at end of file