I am trying to set up a Django app, but everytime I try to run it i get the following error message: NameError: name 'patterns' is not defined
I do not understand what is wrong with my urls.py file, here is a copy of it:
from django.contrib import admin
from rest_framework import routers
from SecMeRe import views
router = routers.DefaultRouter()
#makes sure that the API endpoints work
router.register(r'api/SecMeRe', views.PatientViewSet)
admin.autodiscover()
urlpatterns = patterns(
url(r'^admin/', include(admin.site.urls)),
url(r'^', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
)
Use this:
from django.conf.urls import url, include
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With