0 Replies - 669 Views - Last Post: 30 December 2015 - 07:10 AM Rate Topic: -----

#1 Hype  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 12-December 15

Django settings.STATIC_URL

Posted 30 December 2015 - 07:10 AM

I'm following along with a youtube series and the guy is using Python 2.7 and I'm using 3.4 so it's probably just outdated syntax but can someone tell me what I'm doing wrong here?

from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin


urlpatterns = [
    url(r'^$', 'newsletter.views.home', name='home'),
    url(r'^contact/$', 'newsletter.views.contact', name='contact'),
    url(r'^admin/', include(admin.site.urls)),
]

if settings.DEBUG:
    urlpatterns += static(settings.STATIC.URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA.URL, document_root=settings.MEDIA_ROOT)



I run collectstatic and then try to run the server and it throws an error, something to do with

urlpatterns += static(settings.STATIC.URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA.URL, document_root=settings.MEDIA_ROOT)



Here is the error

Spoiler


Anyone know the correct syntax for 3.4? Thanks.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1