【发布时间】:2021-02-11 18:03:45
【问题描述】:
错误
找不到页面 (404) 请求方法:POST 请求网址:http://localhost:8000/contact/contact 使用portfolio.urls中定义的URLconf
admin/
[name='home']
about/ [name='about']
projects/ [name='projects']
contact/ [name='contact']
The current path, contact/contact, didn't match any of these.
**表单代码**
<form action="contact" method="POST">
{% csrf_token %}
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Your Name">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" name="email" placeholder="name@example.com">
</div>
<div class="form-group">
<label for="phone">Phone Number</label>
<input type="phone" class="form-control" id="phone" name="phone" placeholder="Your Number">
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1">Explain your concern</label>
<textarea class="form-control" id="desc" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-success">Submit</button>
</form>
views.py
def contact(request):
return render(request,"contact.html")
urls.py 此网址来自我的应用
urlpatterns=[
path("",views.home,name="home"),
path("about/",views.about,name="about"),
path("projects/",views.projects,name="projects"),
path("contact/",views.contact,name="contact"),
]
urls.py 此网址来自我的项目
urlpatterns = [
path('admin/', admin.site.urls),
path("",include("home.urls")),
]
【问题讨论】:
标签: html css python-3.x django bootstrap-4