[extensions-web: 75/75] Do some disgusting repulsive hacks to serve the media with Apache under DEBUG.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web: 75/75] Do some disgusting repulsive hacks to serve the media with Apache under DEBUG.
- Date: Fri, 23 Sep 2011 03:20:44 +0000 (UTC)
commit 1d4251f7eed1a0fb96fb267c692550fb4973309e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Sep 22 23:09:24 2011 -0400
Do some disgusting repulsive hacks to serve the media with Apache under DEBUG.
sweettooth/settings.py | 2 +-
sweettooth/urls.py | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/settings.py b/sweettooth/settings.py
index 00557d3..57189e6 100644
--- a/sweettooth/settings.py
+++ b/sweettooth/settings.py
@@ -69,7 +69,7 @@ STATIC_URL = '/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
-ADMIN_MEDIA_PREFIX = '/static/admin/'
+ADMIN_MEDIA_PREFIX = '/static-admin/'
# Additional locations of static files
STATICFILES_DIRS = (
diff --git a/sweettooth/urls.py b/sweettooth/urls.py
index 35614a7..d878426 100644
--- a/sweettooth/urls.py
+++ b/sweettooth/urls.py
@@ -1,4 +1,6 @@
+import os.path
+
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
@@ -27,5 +29,14 @@ else:
urlpatterns.append(url(r'^static/extension-data/(?P<path>.*)', lambda n: None,
name='extension-data'))
+if settings.DEBUG:
+ # XXX - I need to be shot for this
+ # Because we need HTTPS + Apache to test, in debug use
+ # static.serve to serve admin media
+ admin_media_dir = os.path.join(os.path.dirname(admin.__file__), 'media')
+ admin_media_prefix = settings.ADMIN_MEDIA_PREFIX.strip('/')
+
+ urlpatterns.append(url(r'^%s(?P<path>.*)' % (admin_media_prefix,),
+ static.serve, dict(document_root=admin_media_dir)))
urlpatterns += staticfiles_urlpatterns()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]