diff options
Diffstat (limited to 'settings.py')
-rw-r--r-- | settings.py | 248 |
1 files changed, 138 insertions, 110 deletions
diff --git a/settings.py b/settings.py index 3bf047a..ddd06fc 100644 --- a/settings.py +++ b/settings.py @@ -11,10 +11,12 @@ _ = lambda s: s DEBUG = False TEMPLATE_DEBUG = DEBUG MOBILE_TEST = False -DJANGO_EXTENSIONS = False +DEBUG_TOOLBAR = False +SQL_DEBUG = False + # Django settings for chimere project. -PROJECT_NAME = u'Chimère' +PROJECT_NAME = 'Chimere' ROOT_PATH = os.path.realpath(os.path.dirname(__file__)) + "/" EMAIL_HOST = 'localhost' @@ -22,15 +24,18 @@ CONTACT_EMAIL = '' STATIC_URL = '/static/' STATIC_ROOT = ROOT_PATH + 'static/' -TINYMCE_URL = '/tinymce/' -EXTRA_CSS = [] -JQUERY_JS_URLS = [] -JQUERY_CSS_URLS = [] +STATICFILES_DIRS = ( + os.path.join(ROOT_PATH, "chimere_example_static"), +) -OSM_CSS_URLS = ["http://www.openlayers.org/api/theme/default/style.css"] +TINYMCE_URL = '' +JQUERY_JS_URLS = ('/javascript/jquery/jquery.js', + '/javascript/jquery-ui/jquery-ui.js',) +JQUERY_CSS_URLS = ('/javascript/jquery-ui/css/smoothness/jquery-ui.css', + '/javascript/jquery-ui/themes/base/jquery.ui.all.css') GPSBABEL = '/usr/bin/gpsbabel' -# simplify with an error of 5 meters +# simplify with an error of 5 meters GPSBABEL_OPTIONS = 'simplify,crosstrack,error=0.005k' # GPSBABEL_OPTIONS = 'simplify,count=100' @@ -59,13 +64,10 @@ CHIMERE_ALL_DATED_ARE_FRONT = True # allow feeds CHIMERE_FEEDS = True # display a directory of items -CHIMERE_DIRECTORY = False - -CHIMERE_ICON_WIDTH = 21 -CHIMERE_ICON_HEIGHT = 25 -CHIMERE_ICON_OFFSET_X = -10 -CHIMERE_ICON_OFFSET_Y = -25 +CHIMERE_DIRECTORY = True +# content inside the popup or on a specific window +CHIMERE_CONTENT_INSIDE_POPUP = False # display picture inside the description by default or inside a galery? CHIMERE_MINIATURE_BY_DEFAULT = False @@ -75,7 +77,10 @@ CHIMERE_MINIATURE_BY_DEFAULT = False # cf. OpenLayers documentation for more details # OSM mapnik map -CHIMERE_DEFAULT_MAP_LAYER = "new OpenLayers.Layer.OSM.Mapnik('Mapnik')" +CHIMERE_DEFAULT_MAP_LAYER = """new ol.layer.Tile({ + style: 'Road', + source: new ol.source.OSM() +})""" CHIMERE_XAPI_URL = 'http://open.mapquestapi.com/xapi/api/0.6/' CHIMERE_OSM_API_URL = 'api06.dev.openstreetmap.org' # test URL @@ -89,16 +94,16 @@ CHIMERE_SHAPEFILE_ENCODING = 'ISO-8859-1' # it could be a good idea to hide it to an admin who could'nt do that CHIMERE_HIDE_PROPERTYMODEL = False +# clustering of markers CHIMERE_ENABLE_CLUSTERING = False -# enable routing in Chimère +# enable routing in Chimere CHIMERE_ENABLE_ROUTING = False -CHIMERE_ROUTING_TRANSPORT = ( - ('foot', _(u"Foot")), - ('bicycle', _(u"Bicycle")), - ('motorcar', _(u"Motorcar")), -) +CHIMERE_ROUTING_TRANSPORT = (('foot', _(u"Foot")), + ('bicycle', _(u"Bicycle")), + ('motorcar', _(u"Motorcar")), + ) CHIMERE_ROUTING_SPEEDS = { 'foot': ((3, _(u"You are walking slowly")), @@ -115,12 +120,24 @@ CHIMERE_ROUTING_ENGINE = { } CHIMERE_ROUTING_FAIL_MESSAGE = u"""<h3 class='warn'>Attention</h3> -<p>Le moteur de routage a échoué dans sa recherche de trajet. Les points de -départ ou d'arrivée sont peut-être trop loin d'une voie existante ou le trajet +<p>Le moteur de routage a echoue dans sa recherche de trajet. Les points de +depart ou d'arrivee sont peut-etre trop loin d'une voie existante ou le trajet est trop dangereux.</p>""" NOMINATIM_URL = 'http://nominatim.openstreetmap.org/search' +# Fields used to geolocate with nominatim +# (http://wiki.openstreetmap.org/wiki/Nominatim#Search) +# from external sources. Key must be a valid parameters for Nominatim. If given +# value are property slugs use the corresponding value otherwise use it as a +# fixed value +# e.g : {'street':'address', 'city':'city', 'country':u'France'} + +CHIMERE_NOMINATIM_FIELDS = {'street': 'address', 'city': 'city', + 'country': u'France'} +MOBILE_TEST = False +MOBILE_DOMAINS = [] + # thumbnail CHIMERE_THUMBS_SCALE_HEIGHT = 250 CHIMERE_THUMBS_SCALE_WIDTH = None @@ -143,13 +160,15 @@ CHIMERE_SHORT_DESC_LENGTH = 400 CHIMERE_MODIF_EMAIL = _(u"Hello, I would like to propose you a modification " u"about this item: ") -CHIMERE_ROUTING_WARN_MESSAGE = u"<h3 class='warn'>Attention</h3>"\ - u"<p>Cet itinéraire comporte des passages dangereux, nous vous conseillons"\ - u" de modifier votre recherche, en ajoutant par exemple un ou des points "\ - u"d'étape à votre parcours pour éviter les zones de danger.</p>" +CHIMERE_ROUTING_WARN_MESSAGE = "<h3 class='warn'>Attention</h3>"\ + "<p>Cet itineraire comporte des passages dangereux, nous vous conseillons"\ + " de modifier votre recherche, en ajoutant par exemple un ou des points "\ + "d'etape à votre parcours pour eviter les zones de danger.</p>" CHIMERE_CSV_ENCODING = 'ISO-8859-1' +CHIMERE_DEFAULT_ACTIONS = ['view', 'contribute'] +CHIMERE_DEFAULT_ACTION_LABEL = [u"Cartes", u"Ajouter un element"] # generic contact email CONTACT_EMAIL = '' @@ -161,20 +180,19 @@ MANAGERS = ADMINS DATABASES = { 'default': { - 'NAME': 'ratatouille', + 'NAME': 'chimere', 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'HOST': 'localhost', + 'HOST': 'postgres', 'PORT': '5432', - 'USER': 'ratatouille', - 'PASSWORD': 'wiki', + 'USER': 'chimere', + 'PASSWORD': 'chimere', }, } -if 'test' in sys.argv: - SOUTH_TESTS_MIGRATE = False # Local time zone for this installation. Choices can be found here: -# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE +# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html +# #DATETIME-TIMEZONE-SET-TABLE # although not all variations may be possible on all operating systems. # If running in a Windows environment this must be set to the same as your # system time zone. @@ -206,13 +224,13 @@ TEMPLATE_LOADERS = ( 'django.template.loaders.app_directories.Loader', ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE_CLASSES = [ 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', 'django.contrib.messages.middleware.MessageMiddleware' -) +] ROOT_URLCONF = 'chimere_saclay.urls' @@ -243,8 +261,6 @@ INSTALLED_APPS = [ # celery try: import djcelery - import kombu - kombu djcelery.setup_loader() BROKER_URL = 'django://' INSTALLED_APPS += ['kombu.transport.django', @@ -258,60 +274,9 @@ INSTALLED_APPS += [ 'chimere', ] +LOG_PATH = '/var/log/django/' MOBILE_DOMAINS = [] # if you have specific domains for mobile access -LOGFILENAME = '/var/log/django/chimere.log' - -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'handlers': { - # Include the default Django email handler for errors - # This is what you'd get without configuring logging at all. - 'mail_admins': { - 'class': 'django.utils.log.AdminEmailHandler', - 'level': 'ERROR', - # But the emails are plain text by default - HTML is nicer - 'include_html': True, - }, - # Log to a text file that can be rotated by logrotate - 'logfile': { - 'class': 'logging.handlers.WatchedFileHandler', - 'filename': '/var/log/django/chimere.log' - }, - }, - 'loggers': { - # Again, default Django configuration to email unhandled exceptions - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - # Might as well log any errors anywhere else in Django - 'django': { - 'handlers': ['logfile'], - 'level': 'ERROR', - 'propagate': False, - }, - # Your own app - this assumes all your logger names start with "myapp." - 'chimere': { - 'handlers': ['logfile'], - 'level': 'WARNING', # Or maybe INFO or DEBUG - 'propogate': False - }, - }, -} - -CHIMERE_SEARCH_ENGINE = False -# default haystack parameters when search engine is activated -HAYSTACK_CONNECTIONS = { - 'default': { - 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', - 'URL': 'http://127.0.0.1:8080/solr' - }, -} -HAYSTACK_SEARCH_RESULTS_PER_PAGE = 12 -HAYSTACK_AUTOCOMPLETE = False try: from local_settings import * @@ -321,18 +286,49 @@ except ImportError, e: if CHIMERE_SEARCH_ENGINE: INSTALLED_APPS.insert(INSTALLED_APPS.index('south'), 'haystack') -if DJANGO_EXTENSIONS: - INSTALLED_APPS.append('django_extensions') - -if not JQUERY_JS_URLS: - JQUERY_JS_URLS = (STATIC_URL + 'jquery/jquery.min.js', - STATIC_URL + 'jquery-ui/jquery-ui.min.js') - -if not JQUERY_CSS_URLS: - JQUERY_CSS_URLS = (STATIC_URL + 'jquery-ui/smoothness/jquery-ui.css', - STATIC_URL + 'jquery-ui/base/jquery.ui.all.css') +if 'LOGGING' not in globals(): + global LOGGING + LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + # Include the default Django email handler for errors + # This is what you'd get without configuring logging at all. + 'mail_admins': { + 'class': 'django.utils.log.AdminEmailHandler', + 'level': 'ERROR', + # But the emails are plain text by default - HTML is nicer + 'include_html': True, + }, + # Log to a text file that can be rotated by logrotate + 'logfile': { + 'class': 'logging.handlers.WatchedFileHandler', + 'filename': LOG_PATH + 'chimere.log' + }, + }, + 'loggers': { + # Again, default Django configuration to email unhandled exceptions + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + # Might as well log any errors anywhere else in Django + 'django': { + 'handlers': ['logfile'], + 'level': 'ERROR', + 'propagate': False, + }, + # Your own app + # this assumes all your logger names start with "myapp." + 'chimere': { + 'handlers': ['logfile'], + 'level': 'WARNING', # Or maybe INFO or DEBUG + 'propogate': False + }, + }, + } -LOGGING['handlers']['logfile']['filename'] = LOGFILENAME if 'CHIMERE_SHARE_NETWORKS' not in globals(): # after the locals to get the right STATIC_URL @@ -348,14 +344,46 @@ if 'CHIMERE_SHARE_NETWORKS' not in globals(): STATIC_URL + 'chimere/img/twitter.png'), ) -if 'OSM_JS_URLS' not in globals(): - global OSM_JS_URLS - OSM_JS_URLS = [STATIC_URL + "openlayers/OpenLayers.js", - STATIC_URL + "openlayers/SimplePanZoom.js", - "http://www.openstreetmap.org/openlayers/OpenStreetMap.js"] +if 'MAP_CSS_URLS' not in globals(): + global MAP_CSS_URLS + MAP_CSS_URLS = [STATIC_URL + "ol3/ol.css"] + +if 'MAP_JS_URLS' not in globals(): + global MAP_JS_URLS + if DEBUG: + MAP_JS_URLS = [STATIC_URL + "ol3/ol-debug.js"] + else: + MAP_JS_URLS = [STATIC_URL + "ol3/ol.js"] if 'OSM_MOBILE_JS_URLS' not in globals(): - global OSM_MOBILE_JS_URLS - OSM_MOBILE_JS_URLS = [ + global OSM_MOBILE_URLS + OSM_JS_MOBILE_URLS = [ STATIC_URL + "openlayers/OpenLayers.mobile.js", - "http://www.openstreetmap.org/openlayers/OpenStreetMap.js" - ] + STATIC_URL + "openlayers/SimplePanZoom.js", + "http://www.openstreetmap.org/openlayers/OpenStreetMap.js"] + +if DEBUG_TOOLBAR: + if '..' not in sys.path: + sys.path.insert(0, '..') + global DEBUG_TOOLBAR_PANELS + global DEBUG_TOOLBAR_CONFIG + MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware'] + INSTALLED_APPS += ['debug_toolbar'] + DEBUG_TOOLBAR_PANELS = ( + 'debug_toolbar.panels.version.VersionDebugPanel', + 'debug_toolbar.panels.timer.TimerDebugPanel', + 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', + 'debug_toolbar.panels.headers.HeaderDebugPanel', + 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', + 'debug_toolbar.panels.template.TemplateDebugPanel', + 'debug_toolbar.panels.sql.SQLDebugPanel', + 'debug_toolbar.panels.signals.SignalDebugPanel', + 'debug_toolbar.panels.logger.LoggingPanel', + ) + DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False} + + +if SQL_DEBUG: + LOGGING['loggers']['django.db.backends'] = { + 'level': 'DEBUG', + 'handlers': ['console'], + } |