【发布时间】:2020-05-27 01:47:52
【问题描述】:
Wagtail 是否只使用“Promote Tab”中的 slug,或者我应该将 url 设置为 urls.py?
我正在使用 Wagtail,我有 2 页:
a)Ministerios Internacionales Elim
b)Doctrina Elim
我想将 a 设为首页,b 设为:
http://127.0.0.1:8000/doctrina-elim/
现在doctrina/urls.py 是空的:(
我在doctrina/models.py有这个模型:
class DoctrinaIndexPage(Page):
template = 'doctrina/doctrina_index_page.html'
nivel = models.CharField(max_length=255, default='Básico')
subtitle = models.CharField(max_length=255, default='Publicación reciente')
body = RichTextField(blank=True)
content_panels = Page.content_panels + [
FieldPanel('subtitle', classname="full"),
FieldPanel('body', classname="full")
]
视图有这个(doctrina/views.py):
from django.shortcuts import render
# Create your views here.
def home_page(response):
return render(response, "home/home_page.html")
# Create your views here.
def doctrina_index_page(response):
return render(response, "doctrina/doctrina_index_page.html")
在promote tab,它有这个网址:
doctrina-elim
但是在主机名之后输入404,为什么?
结构:
-doctrina
|__pycache.py_
|__migrations.py
|__templates
|___init__.py
|_admin.py
|_apps.py
|_models.py
|_test.py
|_urls.py
|_views.py
-elim
|__pycache_.py
|_settings.py
|_static
|_templates
|___init__.py
|_urls.py
|_wsgi.py
-home
|__pycache_.py
|_migrations.py
|_static
|_templates \ home
|_home_page.html
|_welcome_page.html
|___init__.py
|_models.py
|_urls.py
|_views.py
我只能在将它们设置为站点时访问我的页面模型,并访问“/”主页。
【问题讨论】: