gpt4 book ai didi

python - Django 2.0 : combine path and re_path got NoReverseMatch error

转载 作者:行者123 更新时间:2023-11-28 17:09:10 24 4
gpt4 key购买 nike

<分区>

在项目的 urls.py 中使用 path,并在应用程序的 urls.py 中使用 re_path,我得到了NoReverseMatch 错误,我项目的 urls.py:

from django.contrib import admin
from django.urls import path, include, re_path

urlpatterns = [
path('user/', include('user.urls', namespace='user'))
]

我的应用程序的 urls.py:

urlpatterns = [
re_path('activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/',
views.activate_account, name='activate'),
]

无法获取正确的url,错误信息:

django.urls.exceptions.NoReverseMatch: Reverse for 'activate' with keyword arguments '{'uidb64': b'Mjc', 'token': '4tv-d4250012f57297ad82a6'}' not found. 1 pattern(s) tried: ['user\\/activate/(?P<uidb64>[0-9A-Za-z_\\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/']

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com