How to configure BaseURL in Django4?

I'm new to django and trying to set a baseURL in django4. I came upon How to set base URL in Django of which the solution is:

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

urlpatterns = [
    url(r'^someuri/', include([
        url(r'^admin/', include( ),
        url(r'^other/$', views.other)

but this import statement:

from django.conf.urls import url


Cannot find reference 'url' in '' 

What am I doing wrong?

django.conf.urls has been replaced by django.urls (actually back in Django 2.0, in 2017), and url is re_path these days. However, if you don't need a regexp route, just use path:

from django.urls import include, path
from . import views

urlpatterns = [
                path("admin/", include(,
                path("other/", views.other),

Back to Top