=== modified file 'lava_server/settings/common.py'
@@ -72,8 +72,27 @@
"django.contrib.admin",
]
-LOGIN_REDIRECT_URL = '/'
-
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+MEDIA_URL = "/media/"
+
+# URL that handles the media served from STATIC_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://static.lawrence.com", "http://example.com/static/"
+STATIC_URL = "/static/"
+
+# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
+# trailing slash.
+# Examples: "http://foo.com/media/", "/media/".
+ADMIN_MEDIA_PREFIX = "/static/admin/"
+
+# The true outer url is /lava-server/
+LOGIN_REDIRECT_URL = "/"
+
+# URL of the login screen, has to be hard-coded like that for Django.
+# I cheat a little, using DATA_URL_PREFIX here is technically incorrect
+# but it seems better than hard-coding 'lava-server' yet again.
LOGIN_URL = '/accounts/login/'
INSTALLED_APPS = [
=== modified file 'lava_server/settings/development.py'
@@ -69,27 +69,6 @@
DEBUG_PROPAGATE_EXCEPTIONS = True
TEMPLATE_DEBUG = DEBUG
-# Application URL prefix defines where the application is located at
-# runtime with regards to URLs. Data URL prefix does the same but for
-# static and media files.
-#
-# Development settings use empty value to make localhost:8000 point
-# to the application. Production values can use anything but this
-# needs to be in sync with web server configuration. Debian
-# recommends package name as the prefix so that multiple web
-# applications can co-exists on one server without
-# namespace clashes.
-#
-# The prefix _MUST_ end with a slash when not empty.
-
-# Code is served directly, WSGI mapping make it appear in "lava-server" but
-# this is done externally to django URL resolver.
-APP_URL_PREFIX = r""
-# Data is served by external web server in "lava-server/"
-DATA_URL_PREFIX = r""
-
-
-# XXX: this is ugly!
# It would be good to have rails-like configuration file in the future
devel_db = os.getenv("DEVEL_DB", "sqlite")
if devel_db == "pgsql":
@@ -125,45 +104,31 @@
# Example: "/home/media/static.lawrence.com/"
STATIC_ROOT = os.path.join(PROJECT_STATE_DIR, "static")
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = "/" + DATA_URL_PREFIX + "media/"
-
-# URL that handles the media served from STATIC_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://static.lawrence.com", "http://example.com/static/"
-STATIC_URL = "/" + DATA_URL_PREFIX + "static/"
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = "/" + DATA_URL_PREFIX + "static/admin/"
-
-if not DEBUG:
- raise Exception(
- "You need to configure MEDIA_URL, STATIC_URL and ADMIN_MEDIA_PREFIX to"
- "point to a production web server")
# Make this unique, and don't share it with anybody.
SECRET_KEY = '00000000000000000000000000000000000000000000000000'
-
+# Use templates from the checkout directory
TEMPLATE_DIRS = (
os.path.join(PROJECT_SRC_DIR, "templates"),
)
-STATICFILES_DIRS = [('lava-server', os.path.join(PROJECT_SRC_DIR, 'htdocs'))]
-
-
+# Serve static files used by lava-server from the checkout directory
+STATICFILES_DIRS = [
+ ('lava-server', os.path.join(PROJECT_SRC_DIR, 'htdocs'))]
+
+
+# Try using devserver if available, devserver is a very useful extension that
+# makes debugging applications easier. It shows a lot of interesting output,
+# like SQL queries and timings for each request. It also supports
+# multi-threaded or multi-process server so some degree of parallelism can be
+# achieved.
try:
import devserver
INSTALLED_APPS += ['devserver']
except ImportError:
pass
-# Login redirects back to home
-LOGIN_REDIRECT_URL = '/'
# Any emails that would normally be sent are redirected to stdout.
# This setting is only used for django 1.2 and newer.
=== modified file 'lava_server/settings/production.py'
@@ -21,50 +21,3 @@
DEBUG = False
TEMPLATE_DEBUG = DEBUG
-
-# Application URL prefix defines where the application is located at
-# runtime with regards to URLs. Data URL prefix does the same but for
-# static and media files.
-#
-# Development settings use empty value to make localhost:8000 point
-# to the application. Production values can use anything but this
-# needs to be in sync with web server configuration. Debian
-# recommends package name as the prefix so that multiple web
-# applications can co-exists on one server without
-# namespace clashes.
-#
-# Both values _MUST_ end with a slash when not empty.
-
-# Code is served directly, WSGI mapping make it appear in "lava-server" but
-# this is done externally to django URL resolver.
-APP_URL_PREFIX = r""
-# Data is served by external web server in "lava-server/"
-DATA_URL_PREFIX = r"lava-server/"
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = "/" + DATA_URL_PREFIX + "media/"
-
-# URL that handles the media served from STATIC_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://static.lawrence.com", "http://example.com/static/"
-STATIC_URL = "/" + DATA_URL_PREFIX + "static/"
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = "/" + DATA_URL_PREFIX + "static/admin/"
-
-# The true outer url is /lava-server/
-LOGIN_REDIRECT_URL = "/" + DATA_URL_PREFIX
-
-# URL of the login screen, has to be hard-coded like that for Django.
-# I cheat a little, using DATA_URL_PREFIX here is technically incorrect
-# but it seems better than hard-coding 'lava-server' yet again.
-LOGIN_URL = '/' + DATA_URL_PREFIX + 'accounts/login/'
-
-if DEBUG:
- raise Exception(
- "You should not run this application with debugging in a production"
- " environment")
=== modified file 'lava_server/urls.py'
@@ -34,38 +34,38 @@
# Root URL patterns
urlpatterns = patterns(
'',
- url(r'^' + settings.APP_URL_PREFIX + r'$',
+ url(r'^$',
index,
name='lava.home'),
- url(r'^' + settings.APP_URL_PREFIX + r'me/$',
+ url(r'^me/$',
me,
name='lava.me'),
- url(r'^' + settings.APP_URL_PREFIX + r'version/$',
+ url(r'^version/$',
version,
name='lava.version_details'),
- url(r'^' + settings.APP_URL_PREFIX + r'accounts/',
+ url(r'^accounts/',
include('django.contrib.auth.urls')),
- url(r'^' + settings.APP_URL_PREFIX + r'admin/',
+ url(r'^admin/',
include(admin.site.urls)),
- url(r'^' + settings.APP_URL_PREFIX + r'openid/',
+ url(r'^openid/',
include('django_openid_auth.urls')),
- url(r'^' + settings.APP_URL_PREFIX + r'RPC2/',
+ url(r'^RPC2/',
'linaro_django_xmlrpc.views.handler',
name='lava.api_handler',
kwargs={
'mapper': loader.xmlrpc_mapper,
'help_view': 'lava.api_help'}),
- url(r'^' + settings.APP_URL_PREFIX + r'api/help/$',
+ url(r'^api/help/$',
'linaro_django_xmlrpc.views.help',
name='lava.api_help',
kwargs={
'mapper': loader.xmlrpc_mapper}),
- url(r'^' + settings.APP_URL_PREFIX + r'api/',
+ url(r'^api/',
include(api_urls.token_urlpatterns)),
# XXX: This is not needed but without it linaro-django-xmlrpc tests fail
- url(r'^' + settings.APP_URL_PREFIX + r'api/',
+ url(r'^api/',
include(api_urls.default_mapper_urlpatterns)),
- url(r'^' + settings.APP_URL_PREFIX + r'utils/markitup/',
+ url(r'^utils/markitup/',
include('lava_markitup.urls')))