source: src/django_gheat/settings.py@ 9669

Last change on this file since 9669 was 9653, checked in by rick, 13 years ago

Allow prefixing on domain proto to 'hack' a way making relative URLs by making
both CDN variables blank in local_settings.py.

File size: 5.6 KB
Line 
1# Django settings for persisted project.
2
3import os
4PROJECT_HOME = os.path.abspath(os.path.dirname(__file__))
5
6DJANGO_PREFIX = '/d'
7if os.path.isfile(PROJECT_HOME + '/local_settings.py'):
8 try:
9 import local_settings
10 DJANGO_PREFIX = local_settings.DJANGO_PREFIX
11 except (AttributeError,NameError):
12 pass
13
14DJANGO_BALANCERS = OSM_PROXY_BALANCERS = ['a','b','c','d','e','f']
15OSM_PROXY_CDN_DOMAINS = [d + '.osmproxy.wirelessleiden.nl' for d in DJANGO_BALANCERS]
16OSM_PROXY_CDN_DOMAINS_PROTOCOL = 'http://'
17OSM_PREFIX = '/osm-tile-proxy'
18DJANGO_CDN_DOMAINS = [d + '.maps.wirelessleiden.nl' for d in DJANGO_BALANCERS]
19DJANGO_CDN_DOMAINS_PROTOCOL = 'http://'
20
21DEBUG = os.path.exists(PROJECT_HOME + '/enable_debug')
22TEMPLATE_DEBUG = DEBUG
23
24# Required for Etags Caching Implementation
25USE_ETAGS = True
26
27# Please mind(!), enabling will cause it to send emails when DEBUG=False
28ADMINS = (
29# ('Rick van der Zwet', 'info@rickvanderzwet.nl'),
30)
31
32MANAGERS = ADMINS
33
34DATABASES = {
35 'default': {
36 'ENGINE': 'django.db.backends.mysql',
37 'NAME': 'project_heatmap',
38 'USER': 'root',
39 'PASSWORD': '',
40 'HOST': 'localhost',
41 'PORT': '3306',
42 }
43}
44
45CACHES = {
46 'default': {
47 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
48 'LOCATION': '127.0.0.1:11211',
49 'TIMEOUT': 3600 * 24 * 7,
50 'OPTIONS': {
51 'MAX_ENTRIES': 100000
52 }
53 },
54 'osm_proxy': {
55 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
56 'LOCATION': '/usr/local/var/django/cache/osm_proxy',
57 'TIMEOUT': 3600 * 24 * 7,
58 'OPTIONS': {
59 'MAX_ENTRIES': 100000
60 }
61 },
62 'tile_cache': {
63 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
64 'LOCATION': '/usr/local/var/django/cache/tile_cache',
65 'TIMEOUT': 3600 * 24,
66 'OPTIONS': {
67 'MAX_ENTRIES': 100000
68 }
69 },
70}
71
72
73# Local time zone for this installation. Choices can be found here:
74# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
75# although not all choices may be available on all operating systems.
76# If running in a Windows environment this must be set to the same as your
77# system time zone.
78TIME_ZONE = 'America/Chicago'
79
80# Language code for this installation. All choices can be found here:
81# http://www.i18nguy.com/unicode/language-identifiers.html
82LANGUAGE_CODE = 'en-us'
83
84SITE_ID = 1
85
86# If you set this to False, Django will make some optimizations so as not
87# to load the internationalization machinery.
88USE_I18N = True
89
90# Absolute path to the directory that holds media.
91# Example: "/home/media/media.lawrence.com/"
92MEDIA_ROOT = os.path.join(PROJECT_HOME,'sitemedia')
93
94
95# URL that handles the media served from MEDIA_ROOT. Make sure to use a
96# trailing slash if there is a path component (optional in other cases).
97# Examples: "http://media.lawrence.com", "http://example.com/media/"
98MEDIA_URL = DJANGO_PREFIX + '/media/'
99
100# Absolute path to the directory static files should be collected to.
101# Don't put anything in this directory yourself; store your static files
102# in apps' "static/" subdirectories and in STATICFILES_DIRS.
103# Example: "/home/media/media.lawrence.com/static/"
104STATIC_ROOT = os.path.join(PROJECT_HOME,'sitestatic')
105
106
107# URL prefix for static files.
108# Example: "http://media.lawrence.com/static/"
109STATIC_URL = DJANGO_PREFIX + '/static/'
110
111# URL prefix for admin static files -- CSS, JavaScript and images.
112# Make sure to use a trailing slash.
113# Examples: "http://foo.com/static/admin/", "/static/admin/".
114ADMIN_MEDIA_PREFIX = DJANGO_PREFIX + '/static/admin/'
115
116# Additional locations of static files
117STATICFILES_DIRS = (
118 # PROJECT_HOME + '/static',
119 # Put strings here, like "/home/html/static" or "C:/www/django/static".
120 # Always use forward slashes, even on Windows.
121 # Don't forget to use absolute paths, not relative paths.
122)
123
124# List of finder classes that know how to find static files in
125# various locations.
126STATICFILES_FINDERS = (
127 'django.contrib.staticfiles.finders.FileSystemFinder',
128 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
129# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
130)
131
132# Make this unique, and don't share it with anybody.
133SECRET_KEY = '=wg@x19kr@26sibiaynb9ax5ddp1&yu^+$3n++^_lz1ms80syb'
134
135# List of callables that know how to import templates from various sources.
136TEMPLATE_LOADERS = (
137 'django.template.loaders.filesystem.Loader',
138 'django.template.loaders.app_directories.Loader',
139 'django.template.loaders.eggs.Loader',
140)
141
142# XXX: MiddleWare Cache is causing sever slowdowns, wrong cache maybe, why?
143MIDDLEWARE_CLASSES = (
144# 'django.middleware.cache.UpdateCacheMiddleware',
145 'django.middleware.common.CommonMiddleware',
146# 'django.middleware.cache.FetchFromCacheMiddleware',
147# 'django.middleware.http.ConditionalGetMiddleware',
148 'django.contrib.sessions.middleware.SessionMiddleware',
149 'django.contrib.auth.middleware.AuthenticationMiddleware',
150)
151
152ROOT_URLCONF = 'urls'
153
154TEMPLATE_DIRS = (
155 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
156 # Always use forward slashes, even on Windows.
157 # Don't forget to use absolute paths, not relative paths.
158 os.path.join(PROJECT_HOME, 'templates'),
159)
160
161INSTALLED_APPS = (
162 'django.contrib.admin',
163 'django.contrib.auth',
164 'django.contrib.contenttypes',
165 'django.contrib.sessions',
166 'django.contrib.sites',
167 'django.contrib.staticfiles',
168 'django_extensions',
169 'gheat',
170 'wlheatmap',
171)
172
173# Include and custom local stuff
174if os.path.isfile(PROJECT_HOME + '/local_settings.py'):
175 from local_settings import *
Note: See TracBrowser for help on using the repository browser.