-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathsettings.py
164 lines (146 loc) · 5.05 KB
/
settings.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
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
# Django settings for the GeoNode project.
import os
import ast
try:
from urllib.parse import urlparse, urlunparse
from urllib.request import urlopen, Request
except ImportError:
from urllib2 import urlopen, Request
from urlparse import urlparse, urlunparse
# Load more settings from a file called local_settings.py if it exists
try:
from {{ project_name }}.local_settings import *
# from geonode.local_settings import *
except ImportError:
from geonode.settings import *
#
# General Django development settings
#
PROJECT_NAME = "{{ project_name }}"
# add trailing slash to site url. geoserver url will be relative to this
if not SITEURL.endswith("/"):
SITEURL = "{}/".format(SITEURL)
SITENAME = os.getenv("SITENAME", "{{ project_name }}")
# Defines the directory that contains the settings file as the LOCAL_ROOT
# It is used for relative settings elsewhere.
LOCAL_ROOT = os.path.abspath(os.path.dirname(__file__))
WSGI_APPLICATION = "{}.wsgi.application".format(PROJECT_NAME)
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = os.getenv("LANGUAGE_CODE", "en")
if PROJECT_NAME not in INSTALLED_APPS:
INSTALLED_APPS += (PROJECT_NAME,)
# Location of url mappings
ROOT_URLCONF = os.getenv("ROOT_URLCONF", "{}.urls".format(PROJECT_NAME))
# Additional directories which hold static files
# - Give priority to local geonode-project ones
STATICFILES_DIRS = [
os.path.join(LOCAL_ROOT, "static"),
] + STATICFILES_DIRS
# Location of locale files
LOCALE_PATHS = (os.path.join(LOCAL_ROOT, "locale"),) + LOCALE_PATHS
TEMPLATES[0]["DIRS"].insert(0, os.path.join(LOCAL_ROOT, "templates"))
loaders = TEMPLATES[0]["OPTIONS"].get("loaders") or [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
]
# loaders.insert(0, 'apptemplates.Loader')
TEMPLATES[0]["OPTIONS"]["loaders"] = loaders
TEMPLATES[0].pop("APP_DIRS", None)
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s %(process)d "
"%(thread)d %(message)s"
},
"simple": {
"format": "%(message)s",
},
},
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
"handlers": {
"console": {
"level": "ERROR",
"class": "logging.StreamHandler",
"formatter": "simple",
},
"mail_admins": {
"level": "ERROR",
"filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler",
},
},
"loggers": {
"django": {
"handlers": ["console"],
"level": "ERROR",
},
"geonode": {
"handlers": ["console"],
"level": "INFO",
},
"geoserver-restconfig.catalog": {
"handlers": ["console"],
"level": "ERROR",
},
"owslib": {
"handlers": ["console"],
"level": "ERROR",
},
"pycsw": {
"handlers": ["console"],
"level": "ERROR",
},
"celery": {
"handlers": ["console"],
"level": "DEBUG",
},
"mapstore2_adapter.plugins.serializers": {
"handlers": ["console"],
"level": "DEBUG",
},
"geonode_logstash.logstash": {
"handlers": ["console"],
"level": "DEBUG",
},
},
}
CENTRALIZED_DASHBOARD_ENABLED = ast.literal_eval(
os.getenv("CENTRALIZED_DASHBOARD_ENABLED", "False")
)
if (
CENTRALIZED_DASHBOARD_ENABLED
and USER_ANALYTICS_ENABLED
and "geonode_logstash" not in INSTALLED_APPS
):
INSTALLED_APPS += ("geonode_logstash",)
CELERY_BEAT_SCHEDULE["dispatch_metrics"] = {
"task": "geonode_logstash.tasks.dispatch_metrics",
"schedule": 3600.0,
}
LDAP_ENABLED = ast.literal_eval(os.getenv("LDAP_ENABLED", "False"))
if LDAP_ENABLED and "geonode_ldap" not in INSTALLED_APPS:
INSTALLED_APPS += ("geonode_ldap",)
# Add your specific LDAP configuration after this comment:
# https://docs.geonode.org/en/master/advanced/contrib/#configuration