u/420epicdude6767

Hey! I'm following this tutorial which I'm supposed to follow for an assignment I was given... Unfortunately, its out of date. I was just mostly wondering for this section of the video, am I supposed to change this little section out to match something to look like this?

from django.conf.urls import url,includefrom django.conf.urls import url,include

In a previous, step, within urls.py, I change

from django.conf.urls import urls
from EmployeeApp import views


urlpatterns = [
    url(r'^department/$',views.departmentApi),
    url(r'^department/([0-9]+)$',views.departmentApi)
]from django.conf.urls import urls
from EmployeeApp import views


urlpatterns = [
    url(r'^department/$',views.departmentApi),
    url(r'^department/([0-9]+)$',views.departmentApi)
]

to the following

from django.urls import include, re_path
from EmployeeApp import views


urlpatterns = [
    re_path(r'^department/$',views.departmentApi),
    re_path(r'^department/([0-9]+)$',views.departmentApi)
]from django.urls import include, re_path
from EmployeeApp import views


urlpatterns = [
    re_path(r'^department/$',views.departmentApi),
    re_path(r'^department/([0-9]+)$',views.departmentApi)
]

(specifically, changing url to re_path and from django.conf.urls import urls to from django.urls import include, re_path

I should also mention, this is the following error I am getting

  File "/home/user/Desktop/python/DjangoAngular/DjangoAPI/DjangoAPI/urls.py", line 20, in <module>
    from django.conf.urls import include, re_path
ImportError: cannot import name 're_path' from 'django.conf.urls' (/home/user/Desktop/python/DjangoAngular/myenv/lib/python3.12/site-packages/django/conf/urls/__init__.py)

Please ask if I'm missing any information I should provide, and apologies if I'm not making the most sense or something I'm really tired and have been at this for waayyy too long

u/420epicdude6767 — 15 days ago