python - 找不到页面错误。请求地址是否错误?

标签 python html django

我收到错误,找不到页面。 在profile.html中,我写了

 <!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)

最佳答案

用户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>

关于python - 找不到页面错误。请求地址是否错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42241958/

相关文章:

python - 如何测试 pygame 屏幕中的 2d 点是否是 PyOpenGL 中 3d 对象的一部分?

python Selenium : WinError 10053 - host is shutting connection down

javascript - 如何使 google recaptcha 响应宽度为 100%

javascript - 如何在 PHP 中添加带有 JS 函数的输入标签

django - 检索访问 token : b'{\n "error": "redirect_uri_mismatch", 时出错\n "error_description": "Bad Request"\n}'

python - 提速生成器->列表-> Python中的CSV

python - 关系抽取中如何获取有方向的实体?

html - 我怎样才能阻止我的 div.content 与我的标题重叠?

python - 使用 Django 的 QuerySet 从 2 个不同的表中检索值

python - 如何将相关数据添加到 haystack 模型索引中?