Commits

Ales Zabala Alava  committed 6883255

update test_project to django 1.3: use staticfiles

  • Participants
  • Parent commits fd7887f

Comments (0)

Files changed (2)

File test_project/settings.py

     }
 }
 
+STATIC_URL = ADMINFILES_MEDIA_URL = '/static/'
+STATIC_ROOT = os.path.join(BASE, 'static')
 MEDIA_ROOT = os.path.join(BASE, 'media')
 MEDIA_URL = '/media/'
-ADMIN_MEDIA_PREFIX = '/media/admin/'
+ADMIN_MEDIA_PREFIX = '/static/admin/'
 SECRET_KEY = '6wk#pb((9+oudihdco6m@#1hmr1qp#k+7a=p7c@#z91_^=en-!'
 
 ROOT_URLCONF = 'test_project.urls'
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
+    'django.contrib.staticfiles',
     'django.contrib.admin',
     'adminfiles',
     'sorl.thumbnail',

File test_project/urls.py

 from django.conf.urls.defaults import *
 from django.conf import settings
 
+from django.contrib.staticfiles.urls import staticfiles_urlpatterns
+from django.conf.urls.static import static
+
 from django.contrib import admin
 admin.autodiscover()
 
 )
 
 if settings.DEBUG:
-    urlpatterns += patterns('',
-        (r'^media/(?P<path>.*)$', 'django.views.static.serve',
-            {'document_root': settings.MEDIA_ROOT}),
-    )
+    urlpatterns += staticfiles_urlpatterns()
+    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)