2

我尝试使用重定向快捷方式发出重定向,但出现以下错误

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)),
)
4

1 回答 1

2

您的 url 模式似乎有点奇怪,请尝试:

url(r'^(.*)$', redirect('macmonster.views.home')),
于 2013-02-20T21:44:56.783 回答