/
base.py
178 lines (139 loc) · 5.55 KB
/
base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
"""
Copy this to settings.py, uncomment the various settings, and
edit them as desired.
"""
from ebpub.settings_default import *
########################
# CORE DJANGO SETTINGS #
########################
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'openrural',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
ADMINS = (
('Open Rural Team', 'openrural-team@caktusgroup.com'),
)
MANAGERS = ADMINS
DEBUG = True
TIME_ZONE = 'US/Eastern'
PROJECT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(__file__)))
INSTALLED_APPS = (
'djcelery',
'openrural',
'gunicorn',
'openrural.data_dashboard',
'openrural.periodic_tasks',
'django.contrib.messages',
) + INSTALLED_APPS
TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates'), ) + TEMPLATE_DIRS
ROOT_URLCONF = 'openrural.urls'
#########################
# CUSTOM EBPUB SETTINGS #
#########################
# The domain for your site.
EB_DOMAIN = 'localhost'
# This is the short name for your city, e.g. "chicago".
SHORT_NAME = 'whiteville'
# Where to center citywide maps, eg. on homepage.
DEFAULT_MAP_CENTER_LON = -78.62
DEFAULT_MAP_CENTER_LAT = 34.22
DEFAULT_MAP_ZOOM = 9
# Metros. You almost certainly only want one dictionary in this list.
# See the configuration docs for more info.
METRO_LIST = (
{
# Extent of the region, as a longitude/latitude bounding box.
'extent': (-79.131456, 33.926189, -78.145433, 34.475916),
# Whether this region should be displayed to the public.
'is_public': True,
# Set this to True if the region has multiple cities.
# You will also need to set 'city_location_type'.
'multiple_cities': True,
# The major city in the region.
'city_name': 'Whiteville',
# The SHORT_NAME in the settings file.
'short_name': SHORT_NAME,
# The name of the region, as opposed to the city (e.g., "Miami-Dade" instead of "Miami").
'metro_name': 'Columbus County',
# USPS abbreviation for the state.
'state': 'NC',
# Full name of state.
'state_name': 'North Carolina',
# Time zone, as required by Django's TIME_ZONE setting.
'time_zone': TIME_ZONE,
# Slug of an ebpub.db.LocationType that represents cities.
# Only needed if multiple_cities = True.
'city_location_type': 'cities',
},
)
# Set both of these to distinct, secret strings that include two instances
# of '%s' each. Example: 'j8#%s%s' -- but don't use that, because it's not
# secret. And don't check the result in to a public code repository
# or otherwise put it out in the open!
PASSWORD_CREATE_SALT = '%s%s'
PASSWORD_RESET_SALT = '%s%s'
# You probably don't need to override this, the setting in settings.py
# should work out of the box.
#EB_MEDIA_ROOT = '' # necessary for static media versioning.
EB_MEDIA_URL = '' # leave at '' for development
# This is used as a "From:" in e-mails sent to users.
GENERIC_EMAIL_SENDER = 'no-reply@' + EB_DOMAIN
# Filesystem location of scraper log.
SCRAPER_LOGFILE_NAME = '/tmp/scraperlog_openrural'
# If this cookie is set with the given value, then the site will give the user
# staff privileges (including the ability to view non-public schemas).
STAFF_COOKIE_NAME = 'obstaff_openrural'
STAFF_COOKIE_VALUE = ''
# What LocationType to redirect to when viewing /locations.
DEFAULT_LOCTYPE_SLUG = 'cities'
# What kinds of news to show on the homepage.
# This is one or more Schema slugs.
HOMEPAGE_DEFAULT_NEWSTYPES = [u'news-articles']
# How many days of news to show on the homepage, place detail view,
# and elsewhere.
DEFAULT_DAYS = 14
# Edit this if you want to control where
# scraper scripts will put their HTTP cache.
# (Warning, don't put it in a directory encrypted with ecryptfs
# or you'll likely have "File name too long" errors.)
HTTP_CACHE = '/tmp/openblock_scraper_cache_openrural'
CACHES = {
# Use whatever Django cache backend you like;
# FileBasedCache is a reasonable choice for low-budget, memory-constrained
# hosting environments.
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': '/tmp/openrural_cache'
# # Use this to disable caching.
#'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
MAP_BASELAYER_TYPE = 'osm.mapnik'
LOGGING['formatters']['basic'] = {
'format': '%(asctime)s %(name)-20s %(levelname)-8s %(message)s',
}
LOGGING['loggers'][''] = {'handlers': ['null'], 'level': 'INFO',
'propagate': True}
LOGGING['loggers']['openrural'] = {'propagate': True, 'level': 'DEBUG'}
LOGGING['loggers']['ebpub'] = {'propagate': True, 'level': 'DEBUG'}
LOGGING['loggers']['ebdata'] = {'propagate': True, 'level': 'DEBUG'}
LOGGING['loggers']['eb'] = {'propagate': True, 'level': 'DEBUG'}
LOGGING['loggers']['data_dashboard'] = {'propagate': True, 'level': 'DEBUG'}
LOGGING['loggers']['django'] = {'propagate': True, 'level': 'INFO'}
LOGGING['loggers']['celery'] = {'propagate': True, 'level': 'INFO'}
LOGGING['loggers']['django.request'] = {'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False}
CELERYD_HIJACK_ROOT_LOGGER = False
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
STATICFILES_DIRS = (os.path.join(PROJECT_DIR, 'static'), )
# include project templates dir?
PROJECT_TEMPLATES = True
# Email address which the public can use to contact the editor
OPENRURAL_EDITOR_EMAIL = 'openrural@unc.edu'