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
|
|
|
|
|
|
|
|
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'),
|
2013-12-04 16:19:19 -06:00
|
|
|
('it', u'Italiano'),
|
|
|
|
('pt', u'Portuguese'),
|
|
|
|
('nl', u'Dutch'),
|
|
|
|
('es', u'Español'),
|
|
|
|
('fi', u'Finnish'),
|
|
|
|
('de', u'Deutsch'),
|
2013-12-07 06:22:59 -06:00
|
|
|
('da', u'Danish'),
|
2013-12-11 13:25:46 -06:00
|
|
|
('ja', u'Japanese'),
|
2014-02-10 09:54:01 -06:00
|
|
|
('lt', u'Lithuanian'),
|
2014-04-14 03:03:46 -05:00
|
|
|
('cs-cz', u'Czech'),
|
2014-04-25 04:52:46 -05:00
|
|
|
('ca', u'Catalan'),
|
2014-06-26 13:40:44 -05:00
|
|
|
('zh', u'Chinese'),
|
2014-08-24 12:51:20 -05:00
|
|
|
('zh-tw', u'Chinese'),
|
2014-07-10 16:46:06 -05:00
|
|
|
('ru', u'Russian'),
|
2014-07-20 09:10:32 -05:00
|
|
|
('bg', u'Bulgarian'),
|
2014-08-13 16:56:01 -05:00
|
|
|
('vi', u'Vietnamese'),
|
2014-09-17 03:54:44 -05:00
|
|
|
('uk-ua', u'Ukrainian'),
|
2015-11-17 07:35:59 -06:00
|
|
|
('am-et', u'Amharic'),
|
2016-11-06 15:52:33 -06:00
|
|
|
('sk-sk', 'Slovak'),
|
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 = (
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'django.contrib.admin',
|
2015-08-02 11:08:31 -05:00
|
|
|
'django.contrib.gis',
|
|
|
|
|
|
|
|
'leaflet_storage',
|
|
|
|
'umap',
|
|
|
|
'compressor',
|
2017-01-09 03:13:21 -06:00
|
|
|
'social_django',
|
2012-11-20 03:47:19 -06:00
|
|
|
)
|
|
|
|
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Calculation of directories relative to the project module location
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
import os
|
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__))
|
|
|
|
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Project URLS and media settings
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2013-01-02 08:49:20 -06:00
|
|
|
ROOT_URLCONF = 'umap.urls'
|
2016-09-10 09:21:09 -05:00
|
|
|
WSGI_APPLICATION = 'umap.wsgi.application'
|
2012-11-20 03:47:19 -06:00
|
|
|
|
|
|
|
LOGIN_URL = '/login/'
|
|
|
|
LOGOUT_URL = '/logout/'
|
|
|
|
LOGIN_REDIRECT_URL = '/'
|
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
MEDIA_URL = '/uploads/'
|
|
|
|
|
2014-06-16 07:02:18 -05:00
|
|
|
STATIC_ROOT = os.path.join('static')
|
|
|
|
MEDIA_ROOT = os.path.join('uploads')
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2016-09-10 09:21:09 -05:00
|
|
|
|
2012-11-20 03:47:19 -06:00
|
|
|
STATICFILES_DIRS = (
|
|
|
|
os.path.join(PROJECT_DIR, 'static'),
|
|
|
|
)
|
|
|
|
|
2016-04-24 09:14:47 -05:00
|
|
|
STATICFILES_FINDERS = [
|
2012-12-22 05:42:29 -06:00
|
|
|
'compressor.finders.CompressorFinder',
|
2015-10-17 01:52:29 -05:00
|
|
|
# 'npm.finders.NpmFinder',
|
2016-04-24 09:14:47 -05:00
|
|
|
] + STATICFILES_FINDERS
|
2012-12-22 05:42:29 -06:00
|
|
|
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Templates
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2016-04-25 16:53:58 -05:00
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'APP_DIRS': True,
|
2016-06-24 04:17:17 -05:00
|
|
|
'DIRS': [
|
2016-04-25 16:53:58 -05:00
|
|
|
os.path.join(PROJECT_DIR, 'templates'),
|
2016-06-24 04:17:17 -05:00
|
|
|
],
|
2016-04-25 16:53:58 -05:00
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': (
|
2016-08-20 05:04:08 -05:00
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.i18n',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
'django.template.context_processors.media',
|
|
|
|
'django.template.context_processors.static',
|
|
|
|
'django.template.context_processors.tz',
|
2017-01-09 03:13:21 -06:00
|
|
|
'social_django.context_processors.backends',
|
|
|
|
'social_django.context_processors.login_redirect',
|
2016-06-30 07:41:10 -05:00
|
|
|
'umap.context_processors.settings',
|
2016-04-25 16:53:58 -05:00
|
|
|
'umap.context_processors.version',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
]
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2014-04-19 13:26:41 -05:00
|
|
|
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Middleware
|
2015-10-17 01:52:29 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2018-05-18 14:40:38 -05:00
|
|
|
MIDDLEWARE = (
|
2014-04-24 16:20:25 -05:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
2012-12-27 07:59:05 -06:00
|
|
|
'django.middleware.locale.LocaleMiddleware',
|
2014-04-24 16:20:25 -05:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2012-11-20 03:47:19 -06:00
|
|
|
)
|
|
|
|
|
2018-05-18 14:40:38 -05:00
|
|
|
|
2015-10-11 03:23:48 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Auth / security
|
2015-10-11 03:23:48 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2016-09-09 14:00:32 -05:00
|
|
|
ENABLE_ACCOUNT_LOGIN = False
|
2012-11-20 03:47:19 -06:00
|
|
|
AUTHENTICATION_BACKENDS += (
|
|
|
|
)
|
|
|
|
|
2015-08-02 11:08:31 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Miscellaneous project settings
|
2015-08-02 11:08:31 -05:00
|
|
|
# =============================================================================
|
2013-03-30 20:33:27 -05:00
|
|
|
LEAFLET_STORAGE_ALLOW_ANONYMOUS = False
|
2014-01-09 08:20:57 -06:00
|
|
|
LEAFLET_STORAGE_EXTRA_URLS = {
|
2015-10-11 03:23:48 -05:00
|
|
|
'routing': 'http://www.openstreetmap.org/directions?engine=osrm_car&route={lat},{lng}&locale={locale}#map={zoom}/{lat}/{lng}', # noqa
|
2014-04-19 05:28:24 -05:00
|
|
|
'ajax_proxy': '/ajax-proxy/?url={url}'
|
2014-01-09 08:20:57 -06:00
|
|
|
}
|
2016-09-09 13:42:17 -05:00
|
|
|
LEAFLET_STORAGE_KEEP_VERSIONS = 10
|
2013-03-30 20:33:27 -05:00
|
|
|
SITE_URL = "http://umap.org"
|
2016-06-30 07:41:10 -05:00
|
|
|
SITE_NAME = 'uMap'
|
2013-05-01 17:54:40 -05:00
|
|
|
UMAP_DEMO_SITE = False
|
2016-01-02 06:21:24 -06:00
|
|
|
UMAP_EXCLUDE_DEFAULT_MAPS = False
|
2016-01-02 06:42:57 -06:00
|
|
|
UMAP_MAPS_PER_PAGE = 5
|
|
|
|
UMAP_MAPS_PER_PAGE_OWNER = 10
|
2013-06-16 11:08:08 -05:00
|
|
|
MAP_SHORT_URL_NAME = "umap_short_url"
|
2014-05-01 16:51:38 -05:00
|
|
|
UMAP_USE_UNACCENT = False
|
2017-01-10 09:57:21 -06:00
|
|
|
UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa
|
2015-08-02 11:08:31 -05:00
|
|
|
USER_MAPS_URL = 'user_maps'
|
2017-05-10 04:12:10 -05:00
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.contrib.gis.db.backends.postgis',
|
|
|
|
'NAME': 'umap',
|
|
|
|
}
|
|
|
|
}
|
2012-11-20 03:47:19 -06:00
|
|
|
|
2015-08-02 11:08:31 -05:00
|
|
|
# =============================================================================
|
2012-11-20 03:47:19 -06:00
|
|
|
# Third party app settings
|
2015-08-02 11:08:31 -05:00
|
|
|
# =============================================================================
|
2012-12-22 05:42:29 -06:00
|
|
|
COMPRESS_ENABLED = True
|
|
|
|
COMPRESS_OFFLINE = True
|
2013-01-11 15:24:48 -06:00
|
|
|
|
|
|
|
SOCIAL_AUTH_DEFAULT_USERNAME = lambda u: slugify(u)
|
|
|
|
SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True
|
|
|
|
LOGIN_URL = "login"
|
|
|
|
SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/login/popup/end/"
|
|
|
|
SOCIAL_AUTH_PIPELINE = (
|
2017-01-09 03:13:21 -06:00
|
|
|
'social_core.pipeline.social_auth.social_details',
|
|
|
|
'social_core.pipeline.social_auth.social_uid',
|
|
|
|
'social_core.pipeline.social_auth.auth_allowed',
|
|
|
|
'social_core.pipeline.social_auth.social_user',
|
|
|
|
'social_core.pipeline.social_auth.associate_by_email',
|
|
|
|
'social_core.pipeline.user.get_username',
|
|
|
|
'social_core.pipeline.user.create_user',
|
|
|
|
'social_core.pipeline.social_auth.associate_user',
|
|
|
|
'social_core.pipeline.social_auth.load_extra_data',
|
|
|
|
'social_core.pipeline.user.user_details'
|
2014-03-06 16:22:37 -06:00
|
|
|
)
|