gpt4 book ai didi

python - Django 重定向快捷方式

转载 作者:行者123 更新时间:2023-12-05 05:27:57 26 4
gpt4 key购买 nike

我试图使用重定向快捷方式发出重定向,但我收到以下错误

raise ImproperlyConfigured("The included urlconf %s doesn't have any patterns in it" % self.urlconf_name)
ImproperlyConfigured: The included urlconf webtools.urls doesn't have any patterns in it

我的 urls.py 文件如下所示:

from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import direct_to_template
from django.views.generic.base import RedirectView
from django.shortcuts import redirect

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
url(r'^.*$', redirect(macmonster.views.home)),
)

最佳答案

你的 url 模式看起来有点奇怪,试试:

url(r'^(.*)$', redirect('macmonster.views.home')),

关于python - Django 重定向快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14990435/

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