diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-08-04 10:11:24 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-08-04 10:11:24 +0300 |
commit | 63b0fc6269b38edf7234b9f151b80d81f614c0a3 (patch) | |
tree | 555de3068f33f8dddb4619349bbea7d9b7c822fd /settings.py | |
download | Servo-63b0fc6269b38edf7234b9f151b80d81f614c0a3.tar.gz Servo-63b0fc6269b38edf7234b9f151b80d81f614c0a3.tar.bz2 Servo-63b0fc6269b38edf7234b9f151b80d81f614c0a3.zip |
Initial commit
First public commit
Diffstat (limited to 'settings.py')
-rw-r--r-- | settings.py | 245 |
1 files changed, 245 insertions, 0 deletions
diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..3e3c863 --- /dev/null +++ b/settings.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2013, First Party Software +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: + +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. + +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +import os +import re +from django.contrib.messages import constants as messages + +MESSAGE_TAGS = { + messages.ERROR: 'danger', +} + +BASE_DIR = os.path.dirname(__file__) +APP_DIR = os.path.join(BASE_DIR, 'servo') + +DEBUG = False +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + ('ServoApp Support', 'support@servoapp.com'), +) + +MANAGERS = ADMINS + +LANGUAGES = ( + ('da', 'Danish'), + ('nl', 'Dutch'), + ('en', 'English'), + ('et', 'Estonian'), + ('fi', 'Finnish'), + ('sv', 'Swedish'), +) + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# If you set this to False, Django will not format dates, numbers and +# calendars according to the current locale. +USE_L10N = True +USE_THOUSAND_SEPARATOR = True + +# If you set this to False, Django will not use timezone-aware datetimes. +USE_TZ = True + +# Absolute filesystem path to the directory that will hold user-uploaded files. +# Example: "/home/media/media.lawrence.com/media/" +MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads') + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash. +# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" +MEDIA_URL = '/files/' + +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/home/media/media.lawrence.com/static/" +#STATIC_ROOT = os.path.join(PROJECT_DIR, 'static') + +# URL prefix for static files. +# Example: "http://media.lawrence.com/static/" +STATIC_URL = '/static/' + +STATIC_ROOT = os.path.dirname(os.path.join(BASE_DIR, 'static')) + +# Additional locations of static files +STATICFILES_DIRS = ( + 'static', +) + +MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + #'django.contrib.staticfiles.finders.DefaultStorageFinder', +) + + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.app_directories.Loader', + 'django.template.loaders.filesystem.Loader', + #'django.template.loaders.eggs.Loader', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.middleware.locale.LocaleMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'servo.lib.middleware.LoginRequiredMiddleware', + 'servo.lib.middleware.TimezoneMiddleware', + # Uncomment the next line for simple clickjacking protection: + 'django.middleware.common.BrokenLinkEmailsMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +) + +ROOT_URLCONF = 'servo.urls.default' + +# Python dotted path to the WSGI application used by Django's runserver. +WSGI_APPLICATION = 'wsgi.application' + +TEMPLATE_DIRS = ( + # Don't forget to use absolute paths, not relative paths. + os.path.join(APP_DIR, 'templates'), + os.path.join(BASE_DIR, 'uploads'), +) + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.humanize', + 'django.contrib.sites', + 'django.contrib.sessions', + #'debug_toolbar', + 'rest_framework', + 'rest_framework.authtoken', + 'mptt', 'bootstrap3', + 'servo', +) + +AUTH_USER_MODEL = 'servo.User' +AUTH_PROFILE_MODULE = 'servo.UserProfile' + +# A sample logging configuration. The only tangible logging +# performed by this configuration is to send an email to +# the site admins on every HTTP 500 error when DEBUG=False. +# See http://docs.djangoproject.com/en/dev/topics/logging for +# more details on how to customize your logging configuration. +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'stderr': { + 'level': 'INFO', + 'class': 'logging.StreamHandler', + }, + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler', + 'include_html': True, + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } +} + +SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" + +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.static", + "django.core.context_processors.request", + "django.core.context_processors.i18n", + "django.contrib.messages.context_processors.messages", +) + +EXEMPT_URLS = [] + +LOGIN_URL = '/login/' +LOGOUT_URL = '/logout/' + +# URLs that should work without logging in +LOGIN_EXEMPT_URLS = [ + LOGIN_URL.lstrip('/'), + 'register/$', + 'checkin/', + 'barcode/', + 'api/messages/', + 'api/status/', + 'api/warranty/', + 'api/orders/', + 'api/notes/', + 'api/users/', + 'api/customers/', + 'api/devices/' +] + +IGNORABLE_404_URLS = ( + re.compile(r'favicon\.ico$'), +) + +TEST_RUNNER = 'servo.tests.NoDbTestRunner' + +EMAIL_HOST = 'mail.servoapp.com' +EMAIL_HOST_PASSWORD = '' +EMAIL_HOST_USER = '' +EMAIL_USE_TLS = True + +DEFAULT_FROM_EMAIL = 'support@servoapp.com' + +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework.authentication.TokenAuthentication', + 'rest_framework.authentication.SessionAuthentication', + ) +} + +ENABLE_RULES = True +TIMEZONE = 'Europe/Helsinki' + +from local_settings import * |