Python 还有一个django url重定向问题

Python 还有一个django url重定向问题,python,html,django,url,redirect,Python,Html,Django,Url,Redirect,下面的视图应该加载一个页面“learn.html”,但出于某种原因,它只是返回到索引 def learn(request): try: ... # everything goes smoothly here, the else clause is evaluated. else: return render(request, 'associate/learn.html', {'dataset':model, 'ordered_groups':ord

下面的视图应该加载一个页面“learn.html”,但出于某种原因,它只是返回到索引

def learn(request):

    try:

    ...  # everything goes smoothly here, the else clause is evaluated.

    else:
        return render(request, 'associate/learn.html', {'dataset':model, 'ordered_groups':ordered_groups})
以下是我的网址:

images\url.py:

urlpatterns = patterns('',
    url(r'^images/', include('images_app.urls', namespace="images_app")),
    url(r'^associate/', include('associate.urls', namespace="associate")),
    url(r'^admin/', include(admin.site.urls)),
)
associate\urls.pyEDIT:我不小心写了images\urls.py-现在更正

urlpatterns = patterns('',
    url(r'^learn/', "associate.views.learn", name='learn'),
    url(r'^$', "associate.views.index", name='index'),
)
这是一个加载良好的索引页面,用户应该通过单击“学习”按钮从该页面重定向到learn.html。但是,索引页只是重新加载

associate\index.html

Choose a dataset 

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}

<form action="{% url 'associate:learn' %}" method="post">
{% csrf_token %}
{% for dataset in datasets %}
    <input type="radio" name="dataset" id="dataset{{ forloop.counter }}" value="{{ dataset.id }}" />
    <label for="dataset{{ forloop.counter }}">{{ dataset }}</label><br />
{% endfor %}
<input type="submit" value="learn" />
</form>
THIS IS THE LEARN PAGE

感谢您的帮助。

有关associate应用程序的URL.py,请尝试此

urlpatterns = patterns('associate',
  url(r'^learn/', "associate.views.learn", name='learn'),
  url(r'^$', "associate.views.index", name='index'),
)

我添加了“associate”,出现错误“ImportError at/associate/learn/No module name associate”我还需要添加其他内容吗?associate应该在设置中的已安装应用程序中。py+Özgürğlu我的已安装应用程序部分中确实有associate。不确定还能是什么。好的,请按以下方式尝试。-将url(r'^associate/',include('associate.url',namespace=“associate”))替换为url(r'^associate/',include('associate.url'))-将url(r'^learn/',associate.views.learn',name='learn')替换为url(r'^learn/',associate.views.learn)+Özgür Eroğlu刚刚尝试了你的建议,我得到了同样的错误:(谢谢你的帮助!)!。