运行localhost:8000 / random-string返回“找不到页面”
我相信我的代码都可以顺利运行,因为如果不是这样,我不认为在运行manage.py runserver时它将成功加载本地主机。
还有另一篇文章,我相信这个问题是相似的,并指出代码环境中的某些内容未正确设置。我试图遵循其他问题的答案,但这对我来说并不太奏效。
要提供更多上下文,这是我的CMD中的错误消息:
financio>manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
September 12, 2019 - 17:37:26
Django version 2.2.5, using settings 'financio.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Not Found: /random-string
[12/Sep/2019 17:37:30] "GET /random-string HTTP/1.1" 404 2327
在嵌套在父文件夹中的预算文件夹中,我有urls.py:
from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('', views.project_list, name='list'),
path('<slug:project:slug>', views.project_detail, name='detail')
]
当我运行localhost:8000 / random-string时,它打算加载以下页面project-detail.html:
{% extends 'budget/base.html' %}
{% block content %}
<div class="container">
<section class="section section-stats">
<div class="row">
<div class="col l4">
<div class="card-panel">
<h6>Savings goal</h6>
<h1>£5000</h1>
</div>
</div>
<div class="col l4">
<div class="card-panel">
<h6>Monthly Budget</h6>
<h1>£500</h1>
</div>
</div>
<div class="col l4">
<div class="card-panel">
<h6>Total Savings</h6>
<h1>£2500</h1>
</div>
</div>
</div>
</section>
</div>
{% endblock %}
关于为什么不加载的任何建议?
答案 0 :(得分:0)
将reveal_options:
minScale: 1.0
maxScale: 1.0
更改为path('<slug:project:slug>', views.project_detail, name='detail')
。