Skip to content

Django 4.0+: ImportError: cannot import name 'url' from 'django.conf.urls' #71

@banesullivan

Description

@banesullivan

It seems this line:

from django.conf.urls import url

Is giving an error:

#20 1.022   File "/usr/local/lib/python3.9/site-packages/raster/urls.py", line 1, in <module>
#20 1.022     from django.conf.urls import url
#20 1.022 ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/local/lib/python3.9/site-packages/django/conf/urls/__init__.py)
------

and needs to be changed to support Django 4.0+ as django.conf.urls.url() was deprecated in Django 3.0, and is removed in Django 4.0+.

I believe a simple fix is to replace this with from django.urls import re_path as url

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions