Internal Server Error: /substances/
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 164, in get_response
response = response.render()
File "C:\Python27\lib\site-packages\django\template\response.py", line 158, in render
self.content = self.rendered_content
File "C:\Python27\lib\site-packages\django\template\response.py", line 135, in rendered_content
content = template.render(context, self._request)
File "C:\Python27\lib\site-packages\django\template\backends\django.py", line 74, in render
return self.template.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py", line 209, in render
return self._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py", line 201, in _render
return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py", line 903, in render
bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py", line 79, in render_node
return node.render(context)
File "C:\Python27\lib\site-packages\django\template\loader_tags.py", line 135, in render
return compiled_parent._render(context)
File "C:\Python27\lib\site-packages\django\template\base.py", line 201, in _render
return self.nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py", line 903, in render
bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py", line 79, in render_node
return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py", line 329, in render
return nodelist.render(context)
File "C:\Python27\lib\site-packages\django\template\base.py", line 903, in render
bit = self.render_node(node, context)
File "C:\Python27\lib\site-packages\django\template\debug.py", line 79, in render_node
return node.render(context)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py", line 507, in render
six.reraise(*exc_info)
File "C:\Python27\lib\site-packages\django\template\defaulttags.py", line 493, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 579, in reverse
return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line 496, in _reverse_with_prefix
(lookup_view_s, args, kwargs, len(patterns), patterns))
NoReverseMatch: Reverse for '' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
[13/Jul/2015 15:32:02]"GET /substances/ HTTP/1.1" 500 185051
urlpatterns = (
url(r'^$', lambda r : HttpResponseRedirect('substances/')),
url(r'^norights/', TemplateView.as_view(template_name="norights.html"), name="norights"),
url(r'^substances/', include('substances.urls')),
url(r'^suppliers/', include('suppliers.urls')),
url(r'^users/', include('users.urls')),
url(r'^sources/', include('sources.urls')),
url(r'^media/(.*)$', 'django.views.static.serve', {'document_root' :settings.MEDIA_ROOT}, name="media"),
)
urlpatterns = (
url(r'^$', SubstanceListView.as_view(), name = 'substance_list'),
url(r'^create$', SubstanceCreateView.as_view(), name = 'substance_create'),
url(r'^update/(?P<pk>\d+)$', SubstanceUpdateView.as_view(), name = 'substance_update'),
url(r'^detail/(?P<pk>\d+)$', SubstanceDetailView.as_view(), name = 'substance_detail'),
url(r'^mutate/(?P<pk>\d+)$', SubstanceMutateView.as_view(), name = 'substance_mutate'),
url(r'^delete/(?P<pk>\d+)$', SubstanceDeleteView.as_view(), name = 'substance_delete'),
url(r'^mutate_check_ajax/(?P<pk>\d+)$', mutate_check_ajax, name = 'mutate_check_ajax'),
url(r'^component_check_ajax$', component_check_ajax, name = 'component_check_ajax'),
url(r'^supplier_check_ajax$', supplier_check_ajax, name = 'supplier_check_ajax'),
url(r'^report', substance_report, name = 'substance_report'),
url(r'^worksheet/(?P<pk>\d+)$', substance_worksheet, name = 'substance_worksheet')
)
What is the value being given to substance_list in your template context? It looks like it may be empty.
Unless 'substance_list' is the actual name of the view? In which case you probably need to add quotes around it in your URL tag:
{% url 'substance_list' %}
As is it is, the template is reading substance_list as a variable. If it is the name, and not a variable, I would suggest looking into Django URL name spaces, which are much easier to diagnose and maintain, and avoid the missing quote issue since there can never be a variable name containing the : character. For example,
{% url 'substance:list' %}
Is much less vague than 'substance_list' since the : version wouldn't also work as a variable name, making it easier to figure out that you want the name of a URL and not a variable name.
https://docs.djangoproject.com/en/1.8/topics/http/urls/#url-namespaces
-James
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e31cf3d3-ed7a-4fa5-bb96-fb546e66e53d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
That particular syntax works in Django 1.4, did you do an upgrade?
-James
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bde30363-a061-482d-8226-501097f83d2c%40googlegroups.com.