2012-12-27 07:59:05 -06:00
|
|
|
# -*- coding:utf-8 -*-
|
|
|
|
|
2012-11-20 03:47:19 -06:00
|
|
|
"""Base settings shared by all environments"""
|
|
|
|
# Import global settings to make it easier to extend settings.
|
|
|
|
from django.conf.global_settings import * # pylint: disable=W0614,W0401
|
2013-01-11 15:24:48 -06:00
|
|
|
from django.template.defaultfilters import slugify
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Generic Django project settings
|
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
DEBUG = True
|
|
|
|
TEMPLATE_DEBUG = DEBUG
|
|
|
|
|
|
|
|
SITE_ID = 1
|
|
|
|
# Local time zone for this installation. Choices can be found here:
|
|
|
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_TZ = True
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
LANGUAGE_CODE = 'en'
|
|
|
|
LANGUAGES = (
|
|
|
|
('en', 'English'),
|
2012-12-27 07:59:05 -06:00
|
|
|
('fr', u'Francais'),
|
2012-11-20 03:47:19 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
# Make this unique, and don't share it with anybody.
|
2013-03-30 20:33:27 -05:00
|
|
|
SECRET_KEY = ''
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
2012-12-22 13:32:11 -06:00
|
|
|
'leaflet_storage',
|
2013-01-02 08:49:20 -06:00
|
|
|
'umap',
|
2012-12-16 08:10:00 -06:00
|
|
|
'sesql',
|
2012-12-22 05:42:29 -06:00
|
|
|
'compressor',
|
2013-01-11 15:24:48 -06:00
|
|
|
'social_auth',
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2013-01-07 08:22:56 -06:00
|
|
|
'south',
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.admindocs',
|
2013-11-11 05:57:34 -06:00
|
|
|
'django.contrib.gis'
|
2012-11-20 03:47:19 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Calculation of directories relative to the project module location
|
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
2013-01-02 08:49:20 -06:00
|
|
|
import umap as project_module
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
PROJECT_DIR = os.path.dirname(os.path.realpath(project_module.__file__))
|
|
|
|
|
|
|
|
PYTHON_BIN = os.path.dirname(sys.executable)
|
|
|
|
ve_path = os.path.dirname(os.path.dirname(os.path.dirname(PROJECT_DIR)))
|
|
|
|
# Assume that the presence of 'activate_this.py' in the python bin/
|
|
|
|
# directory means that we're running in a virtual environment.
|
|
|
|
if os.path.exists(os.path.join(PYTHON_BIN, 'activate_this.py')):
|
|
|
|
# We're running with a virtualenv python executable.
|
|
|
|
VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var')
|
|
|
|
elif ve_path and os.path.exists(os.path.join(ve_path, 'bin',
|
|
|
|
'activate_this.py')):
|
|
|
|
# We're running in [virtualenv_root]/src/[project_name].
|
|
|
|
VAR_ROOT = os.path.join(ve_path, 'var')
|
|
|
|
else:
|
|
|
|
# Set the variable root to a path in the project which is
|
|
|
|
# ignored by the repository.
|
|
|
|
VAR_ROOT = os.path.join(PROJECT_DIR, 'var')
|
|
|
|
|
|
|
|
if not os.path.exists(VAR_ROOT):
|
|
|
|
os.mkdir(VAR_ROOT)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Project URLS and media settings
|
|
|
|
#==============================================================================
|
|
|
|
|
2013-01-02 08:49:20 -06:00
|
|
|
ROOT_URLCONF = 'umap.urls'
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
LOGIN_URL = '/login/'
|
|
|
|
LOGOUT_URL = '/logout/'
|
|
|
|
LOGIN_REDIRECT_URL = '/'
|
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
MEDIA_URL = '/uploads/'
|
|
|
|
|
|
|
|
STATIC_ROOT = os.path.join(VAR_ROOT, 'static')
|
|
|
|
MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads')
|
|
|
|
|
|
|
|
STATICFILES_DIRS = (
|
2012-11-22 13:03:36 -06:00
|
|
|
# Fabric will collect leaflet and draw in this dir
|
|
|
|
os.path.join(PROJECT_DIR, 'remote_static'),
|
2012-11-20 03:47:19 -06:00
|
|
|
os.path.join(PROJECT_DIR, 'static'),
|
|
|
|
)
|
|
|
|
|
2012-12-22 05:42:29 -06:00
|
|
|
STATICFILES_FINDERS += (
|
|
|
|
'compressor.finders.CompressorFinder',
|
|
|
|
)
|
|
|
|
|
2012-11-20 03:47:19 -06:00
|
|
|
#==============================================================================
|
|
|
|
# Templates
|
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
TEMPLATE_DIRS = (
|
|
|
|
os.path.join(PROJECT_DIR, 'templates'),
|
|
|
|
)
|
|
|
|
|
|
|
|
TEMPLATE_CONTEXT_PROCESSORS += (
|
2012-12-07 06:40:57 -06:00
|
|
|
'django.core.context_processors.request',
|
2013-01-11 15:24:48 -06:00
|
|
|
'social_auth.context_processors.social_auth_backends',
|
2012-11-20 03:47:19 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Middleware
|
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES += (
|
2012-12-27 07:59:05 -06:00
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
2012-11-20 03:47:19 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Auth / security
|
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
AUTHENTICATION_BACKENDS += (
|
|
|
|
)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Miscellaneous project settings
|
|
|
|
#==============================================================================
|
2013-03-30 20:33:27 -05:00
|
|
|
LEAFLET_STORAGE_ALLOW_ANONYMOUS = False
|
|
|
|
SITE_URL = "http://umap.org"
|
2013-05-01 17:54:40 -05:00
|
|
|
UMAP_DEMO_SITE = False
|
2013-06-16 11:08:08 -05:00
|
|
|
MAP_SHORT_URL_NAME = "umap_short_url"
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Third party app settings
|
|
|
|
#==============================================================================
|
2012-12-22 05:42:29 -06:00
|
|
|
COMPRESS_ENABLED = True
|
|
|
|
COMPRESS_OFFLINE = True
|
2013-01-11 15:24:48 -06:00
|
|
|
|
|
|
|
SOCIAL_AUTH_ASSOCIATE_URL_NAME = "associate_complete"
|
|
|
|
SOCIAL_AUTH_DEFAULT_USERNAME = lambda u: slugify(u)
|
|
|
|
SOCIAL_AUTH_EXTRA_DATA = False
|
|
|
|
SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True
|
|
|
|
LOGIN_URL = "login"
|
|
|
|
SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/login/popup/end/"
|
|
|
|
SOCIAL_AUTH_PIPELINE = (
|
|
|
|
'social_auth.backends.pipeline.social.social_auth_user',
|
|
|
|
'social_auth.backends.pipeline.associate.associate_by_email',
|
|
|
|
'social_auth.backends.pipeline.user.get_username',
|
|
|
|
'social_auth.backends.pipeline.user.create_user',
|
|
|
|
'social_auth.backends.pipeline.social.associate_user',
|
|
|
|
'social_auth.backends.pipeline.social.load_extra_data',
|
|
|
|
'social_auth.backends.pipeline.user.update_user_details'
|
2013-11-11 05:57:34 -06:00
|
|
|
)
|