Commits

Luke Hatcher  committed a6c15cb

switch to using DEBUG from SERVE_MEDIA

  • Participants
  • Parent commits 04c078c

Comments (0)

Files changed (12)

File docs/deployment.txt

 Media files
 ===========
 
-During development media files were handled for you. Running a production
-Pinax project it is **strongly** recommeneded you do not rely on
-``SERVE_MEDIA = True``. By default, ``SERVE_MEDIA`` is set to ``DEBUG`` which
-likely means moving to production will turn off ``SERVE_MEDIA``.
+During development media files are handled for you by staticfiles. Serving of
+media is controlled by ``DEBUG`` (previous versions of Pinax used an additional
+setting ``SERVE_MEDIA`` that controlled this behavior, but it is now unused).
 
 Pinax, by default, sets ``STATIC_ROOT`` and ``MEDIA_ROOT`` to directories
 within the same directory (``site_media``). This is very beneficial to running

File pinax/projects/account_project/settings.py

 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
-# tells Pinax to serve media through the staticfiles app.
-SERVE_MEDIA = DEBUG
-
 # django-compressor is turned off by default due to deployment overhead for
 # most users. See <URL> for more information
 COMPRESS = False

File pinax/projects/account_project/static/README

  * js/ — stores Javascript files
  * img/ — stores image files
  
-This directory is accessed at /site_media/static/ in runserver when SERVE_MEDIA
+This directory is accessed at /site_media/static/ in runserver when DEBUG
 is True. It is built with build_static for production environments.
 
 See http://pinaxproject.com/docs/dev/media.html for more information.

File pinax/projects/account_project/urls.py

 from django.contrib import admin
 admin.autodiscover()
 
+from staticfiles.urls import staticfiles_urlpatterns
+
 from pinax.apps.account.openid_consumer import PinaxConsumer
 
 
     url(r"^openid/", include(PinaxConsumer().urls)),
 )
 
-
-if settings.SERVE_MEDIA:
-    urlpatterns += patterns("",
-        url(r"", include("staticfiles.urls")),
-    ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+urlpatterns += staticfiles_urlpatterns()
+urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

File pinax/projects/basic_project/settings.py

 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
-# tells Pinax to serve media through the staticfiles app.
-SERVE_MEDIA = DEBUG
-
 # django-compressor is turned off by default due to deployment overhead for
 # most users. See <URL> for more information
 COMPRESS = False

File pinax/projects/basic_project/static/README

  * js/ — stores Javascript files
  * img/ — stores image files
  
-This directory is accessed at /site_media/static/ in runserver when SERVE_MEDIA
+This directory is accessed at /site_media/static/ in runserver when DEBUG
 is True. It is built with build_static for production environments.
 
 See http://pinaxproject.com/docs/dev/media.html for more information.

File pinax/projects/basic_project/urls.py

 from django.contrib import admin
 admin.autodiscover()
 
+from staticfiles.urls import staticfiles_urlpatterns
+
 from pinax.apps.account.openid_consumer import PinaxConsumer
 
 
     url(r"^announcements/", include("announcements.urls")),
 )
 
-
-if settings.SERVE_MEDIA:
-    urlpatterns += patterns("",
-        url(r"", include("staticfiles.urls")),
-    ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+urlpatterns += staticfiles_urlpatterns()
+urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

File pinax/projects/static_project/settings.py

 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
-# tells Pinax to serve media through the staticfiles app.
-SERVE_MEDIA = DEBUG
-
 INTERNAL_IPS = [
     "127.0.0.1",
 ]

File pinax/projects/static_project/urls.py

 from django.conf import settings
 from django.conf.urls.defaults import *
+from django.conf.urls.static import static
 from django.shortcuts import render_to_response
 from django.template import RequestContext
 
+from staticfiles.urls import staticfiles_urlpatterns
+
 
 handler500 = "pinax.views.server_error"
 
     (r"^(.*)$", "pinax.views.static_view")
 )
 
-
-if settings.SERVE_MEDIA:
-    urlpatterns = patterns("",
-        (r"", include("staticfiles.urls")),
-    ) + urlpatterns
+urlpatterns += staticfiles_urlpatterns()
+urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

File pinax/projects/zero_project/settings.py

 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
-# tells Pinax to serve media through the staticfiles app.
-SERVE_MEDIA = DEBUG
-
 # django-compressor is turned off by default due to deployment overhead for
 # most users. See <URL> for more information
 COMPRESS = False

File pinax/projects/zero_project/static/README

  * js/ — stores Javascript files
  * img/ — stores image files
  
-This directory is accessed at /site_media/static/ in runserver when SERVE_MEDIA
+This directory is accessed at /site_media/static/ in runserver when DEBUG
 is True. It is built with build_static for production environments.
 
 See http://pinaxproject.com/docs/dev/media.html for more information.

File pinax/projects/zero_project/urls.py

 from django.contrib import admin
 admin.autodiscover()
 
+from staticfiles.urls import staticfiles_urlpatterns
+
 
 handler500 = "pinax.views.server_error"
 
     url(r"^admin/", include(admin.site.urls)),
 )
 
-
-if settings.SERVE_MEDIA:
-    urlpatterns += patterns("",
-        url(r"", include("staticfiles.urls")),
-    ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+urlpatterns += staticfiles_urlpatterns()
+urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)