Note that there are some explanatory texts on larger screens.

plurals
  1. POThe included urlconf manager.urls doesn't have any patterns in it
    text
    copied!<p><strong>A solution:</strong> Found the following django snippet that seems to work fine (<a href="http://djangosnippets.org/snippets/2445/" rel="noreferrer">http://djangosnippets.org/snippets/2445/</a>)</p> <pre><code>from django.utils.functional import lazy from django.core.urlresolvers import reverse #Workaround for using reverse with success_url in class based generic views #because direct usage of it throws an exception. reverse_lazy = lambda name=None, *args : lazy(reverse, str)(name, args=args) </code></pre> <p>Apparently, there is now a <a href="https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse-lazy" rel="noreferrer">reverse_lazy</a> function in django trunk.</p> <hr> <p><strong>Update:</strong> This error has something to do with me making a call to reverse inside a generic view:</p> <pre><code>class AddObjView(CreateView): form_class = ObjForm template_name = 'manager/obj_add.html' success_url = reverse('manager-personal_objs') </code></pre> <p>Is this not valid?</p> <p>If I instead of generic write something like this, it works:</p> <pre><code>def add_obj(request, pk): a=reverse('manager-personal-objs') return HttpResponse(a) </code></pre> <hr> <p>I have a project with 2 apps in it. Each app has its urls and views. They both work fine, but on the manager app, as soon as I reference the reverse function in the views(any view), I get the following error: Exception Type: ImproperlyConfigured Exception Value: The included urlconf manager.urls doesn't have any patterns in it</p> <p>The urls file:</p> <pre><code>urlpatterns = patterns('', url(r'^$', ObjView.as_view(), name='manager-obj'), url(r'^add/$', AddObjView.as_view(), name='manager-add_obj'), url(r'^personal/$', PersonalObjsView.as_view(), name='manager-personal_objs'), </code></pre> <p>)</p> <p>Exception Location: ...site-packages\django\core\urlresolvers.py in _get_url_patterns, line 283</p> <p>I get this error in the entire site(edit: this apparently happens because an attempt to import the manager.urls will result in the error). If I remove the include manager.urls, everything goes back to work; if I remove the call to reverse, everything is fine; if I try to rewrite manager.urls to a simpler version, it continues with the error.</p> <p>I've been over this many times, can't seem to find anything wrong.</p> <p>edit:root urls.py</p> <pre><code># coding=utf8 from django.conf.urls.defaults import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic.simple import direct_to_template # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Uncomment the admin/doc line below to enable admin documentation: url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), # Home Page url(r'^$', direct_to_template, {'template': 'home.html'}, name="home"), # manager url(r'^manager/', include('manager.urls')), # writing url(r'^writing/', include('writing.urls')), ) urlpatterns += staticfiles_urlpatterns() </code></pre> <p>edit2: Should also be noted that the url template tag works fine in the manager app and the reverse call works if I do it on the other app. Also, every url has a written working view.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload