2017-02-15 80 views
2

我收到一个错误,找不到页面。 在profile.html,我写了页未找到错误。请求URL是否错误?

<!DOCTYPE html> 

    <html lang="ja"> 
    <head> 
     <meta charset="utf-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
     <title>UPLOAD</title> 
    </head> 
    <body> 
    <form action="registration/accounts/fashion_result.html"> 
     <input type="submit" value="ResultShow"> 
    </form> 

    <div class="container"> 
     <form action="{% url 'accounts:upload_save' %}" method="POST" enctype="multipart/form-data"> 
     {% csrf_token %} 
     <input type="file" name="files[]" multiple> 
     <input type="hidden" value="{{ p_id }}" name="p_id"> 
     <input type="submit" value="Upload"> 
     </form> 
    </div> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    </body> 
    </html> 

在这部分

<form action="registration/accounts/fashion_result.html"> 
      <input type="submit" value="ResultShow"> 
</form> 

我想做的事画面过渡(如果我把这个按钮,我想看到fashion_result.html在浏览器中。

但现在,我得到了错误 我该如何解决这个问题?

此外,我加入到urls.py

from django.conf.urls import patterns, url 
from django.views.generic import TemplateView 

urlpatterns = patterns('', 
    url(r'^/fashionresults/$', TemplateView.as_view(template_name='registration/accounts/fashion_result.html'), name='fashionresults' 

) 

在profile.html

<form action="registration/accounts/fashion_result.html">ResultShow</form> 

(在目录中,有fashion_result.html)

+0

你有一个URL匹配'注册/账号/ fashion_result.html'在你的urls.py – peckuliarYak

+0

分享您的网址.py – Darshan

+0

如果你想打开一个模板只意味着使用TemplateView,并把button name形式的形式。 – Cadmus

回答

0

这会为你工作: -

模板 -

<form action="/fashion_result"> 
      <input type="submit" value="ResultShow"> 
</form> 

urls.py: -

from django.conf.urls import url,include 
from webpage import views 
# from django.conf import settings 

urlpatterns = [ 
    url(r'^$',views.home), 
    url(r'^fashion_result/$',views.fashionResult), 

views.py-

0

这取决于地方是位于如果是在同一文件夹中只使用

<form action="fashion_result.html"> 

否则文件做一件事 “Shift +右键点击“文件”然后“复制为路径”

绝对有效的回复并粘贴在“表单动作”中。

+0

thx,你的意见。我写了你的代码,但是只显示了单词,我不能放任何东西。(所以,html文件没有显示)我该怎么办? – user7523656

+0

在表单操作中复制并粘贴该链接。 (表单动作=“粘贴在这里”) – Sindhoor

2

用户TemplateView为解决此问题

from django.conf.urls import patterns, url 
from django.views.generic import TemplateView 

urlpatterns = patterns('', 
    url(r'^/test/$', TemplateView.as_view(template_name='todo/index.html'), name="test"), 
) 

在HTML页面

<a href="{% url 'test' %}" >ResultShow</a> 
+0

thx,你的意见。我写了ur代码,所以显示了一个链接标记。但是如果我把它,没有什么是reload.What我应该怎么做? – user7523656

+0

你可以发布代码吗? – Cadmus

相关问题