Browse files

DEBUG=True is not required to serve static files in Django

  • Loading branch information...
1 parent b2aa6b9 commit 9555ddfdffa88e13880b3da07e2dffd1ecd0b015 Sridhar Ratnakumar committed Jan 27, 2012
Showing with 5 additions and 3 deletions.
  1. +4 −2 settings.py
  2. +1 −1 urls.py
View
6 settings.py
@@ -1,7 +1,7 @@
# Django settings for djangogtd project.
import sys, os
-DEBUG = True
+DEBUG = False
TEMPLATE_DEBUG = DEBUG
ROOT = os.path.abspath(os.path.dirname(__file__))
@@ -12,9 +12,10 @@
MANAGERS = ADMINS
+STACKATO = 'VCAP_SERVICES' in os.environ
## Pull in CloudFoundry's production settings
-if 'VCAP_SERVICES' in os.environ:
+if STACKATO:
import json
vcap_services = json.loads(os.environ['VCAP_SERVICES'])
# XXX: avoid hardcoding here
@@ -117,6 +118,7 @@
'django.contrib.admindocs',
'django.contrib.databrowse',
'django.contrib.humanize',
+ 'django.contrib.staticfiles',
'gtd',
'south',
)
View
2 urls.py
@@ -16,7 +16,7 @@
url(r'^$', lambda request: redirect('/gtd')),
)
-if settings.DEBUG:
+if settings.DEBUG or settings.STACKATO:
from os.path import join, dirname, abspath
urlpatterns += patterns('',
url(r'^media/admin/(?P<path>.*)$', 'django.views.static.serve',

0 comments on commit 9555ddf

Please sign in to comment.