On 1/4/23 14:41, Mark Sapiro wrote:
On 1/4/23 13:54, Dan Caballero wrote: ...
File "/var/www/mailman-www/urls.py", line 20, in <module> from django.conf.urls import include, url ImportError: cannot import name 'url' from 'django.conf.urls' (/opt/mailmanve/lib/python3.9/site-packages/django/conf/urls/__init__.py)"
In Django 3.1 django.conf.urls.url was a deprecated alias to django.urls.re_path and in Django 4.0 it was removed. See, e.g. <https://docs.djangoproject.com/en/3.2/ref/urls/> and <https://docs.djangoproject.com/en/4.0/ref/urls/>.
However, the above Traceback doesn't identify which module contains the
from django.conf.urls import include, url
Looking more closely, I see that it does. It is /var/www/mailman-www/urls.py.
That file probably has contents like
from django.conf.urls import include, url
from django.contrib import admin
from django.urls import reverse_lazy
from django.views.generic import RedirectView
urlpatterns = [
url(r'^$', RedirectView.as_view(
url=reverse_lazy('list_index'),
permanent=True)),
url(r'^postorius/', include('postorius.urls')),
url(r'^hyperkitty/', include('hyperkitty.urls')),
url(r'', include('django_mailman3.urls')),
url(r'^accounts/', include('allauth.urls')),
# Django admin
url(r'^admin/', admin.site.urls),
]
That needs to be changed to
from django.contrib import admin
from django.urls import include, reverse_lazy, re_path
from django.views.generic import RedirectView
urlpatterns = [
re_path(r'^$', RedirectView.as_view(
url=reverse_lazy('list_index'),
permanent=True)),
re_path(r'^postorius/', include('postorius.urls')),
re_path(r'^hyperkitty/', include('hyperkitty.urls')),
re_path(r'', include('django_mailman3.urls')),
re_path(r'^accounts/', include('allauth.urls')),
# Django admin
re_path(r'^admin/', admin.site.urls),
]
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan