]> git.openstreetmap.org Git - osqa.git/blobdiff - settings.py
Fixes the new line problems in the OSQA exporter.
[osqa.git] / settings.py
index 1a9f7e169dd56cf885ddb7a38f32bb60c01c06bf..bd76b22188ea3b1fa50cd03633c7c3f4b9bf61db 100644 (file)
@@ -59,6 +59,26 @@ ALLOW_MAX_FILE_SIZE = 1024 * 1024
 # User settings
 from settings_local import *
 
+try:
+    if len(FORUM_SCRIPT_ALIAS) > 0:
+        APP_URL = '%s/%s' % (APP_URL, FORUM_SCRIPT_ALIAS[:-1])
+except NameError:
+    pass
+
+app_url_split = APP_URL.split("://")
+
+APP_PROTOCOL = app_url_split[0]
+APP_DOMAIN = app_url_split[1].split('/')[0]
+APP_BASE_URL = '%s://%s' % (APP_PROTOCOL, APP_DOMAIN)
+
+FORCE_SCRIPT_NAME = ''
+
+for path in app_url_split[1].split('/')[1:]:
+    FORCE_SCRIPT_NAME = FORCE_SCRIPT_NAME + '/' + path
+
+if FORCE_SCRIPT_NAME.endswith('/'):
+    FORCE_SCRIPT_NAME = FORCE_SCRIPT_NAME[:-1]
+
 INSTALLED_APPS = [
     'django.contrib.auth',
     'django.contrib.contenttypes',
@@ -85,10 +105,11 @@ try:
 except:
     pass
 
-try:
-    import rosetta
-    INSTALLED_APPS.append('rosetta')
-except:
-    pass
+if not DEBUG:
+    try:
+        import rosetta
+        INSTALLED_APPS.append('rosetta')
+    except:
+        pass
 
 AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend',]