これは私のアプリケーションツリーです:
myapp/
assets/
statics/
settings.py
urls.py
\\other stuff
main/
urls.py
views.py
templates/
base.html
index.html
\\other stuff
manage.py
アプリケーションをテストすると、次のエラーが発生します。
Error during template rendering
In template /app/main/templates/base.html, error at line 32
Reverse for 'index' with arguments '()' and keyword arguments '{}' not found.
base.html
エラーに関係するコードは次のとおりです。
{% load i18n %}
\\some stuff
<a class="brand" href="{% url 'index' %}">{{ site.name }}</a> <--- this line is the error
私がmain/urls.py
持っている:
urlpatterns = patterns('',
(r'^$', TemplateView.as_view(template_name="index.html")),
)
私がmyapp/urls.py
持っている:
urlpatterns = patterns('',
url(r'', include('main.urls'), name='index'),
)
誰かが私が間違っていることと、名前'index'
が逆に一致しない理由を教えてもらえますか?