Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 当前路径account/active/Z1s6IYaohOJWeRV4没有';我一个也配不上_Django - Fatal编程技术网

Django 当前路径account/active/Z1s6IYaohOJWeRV4没有';我一个也配不上

Django 当前路径account/active/Z1s6IYaohOJWeRV4没有';我一个也配不上,django,Django,URL.py: path('active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='active_user'), 您只需在url的末尾添加一个斜杠即可修复它account/active/Z1s6IYaohOJWeRV4/对不起,我试过了,但似乎没有解决问题 class ActiveUserView(View): def get(self,request,active_code): user

URL.py:

path('active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name='active_user'),

您只需在url的末尾添加一个斜杠即可修复它
account/active/Z1s6IYaohOJWeRV4/
对不起,我试过了,但似乎没有解决问题
class ActiveUserView(View):
    def get(self,request,active_code):
        users = UserProfile.objects.filter(code=active_code)       
        if users:          
            users.is_active = True
            users.save()  
        else:
            users.delete()       
            return HttpResponse('Fail!Register Again!')
        return HttpResponseRedirect(reverse("account:user_login"))