我正在尝试配置一个使用 wagtail CMS 在前端显示模板(模板已经在文件中)的 django 项目,但是由于这是我第一次使用 wagtail,所以我遇到了问题并且不知道在哪里前往。我已经检查了一些外部资源,比如 YouTube,也许我会得到任何这样的说明,但我似乎没有得到任何说明。
整个项目结构如下所示,这表明整个模板和 html 文件是完整的,但我不知道如何设置它。
如果我使用 运行程序python manage.py runserver
,我会运行项目,在浏览器上打开 localhost:8000 后,我只会看到一个空白屏幕。
主项目的 url.py 文件如下所示:
# django imports
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
# wagtail imports
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocuments_urls
urlpatterns = [
url(r'^django-admin/', admin.site.urls),
url(r'^admin/', include(wagtailadmin_urls)),
url(r'^robots\.txt$', TemplateView.as_view(
template_name='robots.txt', content_type='text/plain'
)),
url(r'^documents/', include(wagtaildocuments_urls)),
]
urlpatterns += i18n_patterns(
url(r'', include(wagtail_urls)),
)
项目结构:
│ manage.py
│
├───about
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ __init__.py
│
├───except_wagtail
│ │ abstract_models.py
│ │ admin.py
│ │ apps.py
│ │ blocks.py
│ │ context_processors.py
│ │ models.py
│ │ settings.py
│ │ sitemap.py
│ │ translation.py
│ │ urls.py
│ │ wagtail_hooks.py
│ │ wsgi.py
│ │ __init__.py
│ │
│ ├───templates
│ │ │ 404.html
│ │ │ 500.html
│ │ │ base.html
│ │ │ base_new.html
│ │ │ robots.txt
│ │ │ sitemap.xml
│ │ │
│ │ ├───about
│ │ │ about_page.html
│ │ │ contact_page.html
│ │ │ event_calendar_page.html
│ │ │ generic_page.html
│ │ │ privacy_page.html
│ │ │ resources_page.html
│ │ │
│ │ ├───index
│ │ │ home_page.html
│ │ │
│ │ ├───knowledge
│ │ │ article_page.html
│ │ │ knowledge_page.html
│ │ │
│ │ ├───news
│ │ │ news_index_page.html
│ │ │ news_page.html
│ │ │
│ │ ├───people
│ │ │ people_page.html
│ │ │ profile_page.html
│ │ │
│ │ ├───projects
│ │ │ project_index_page.html
│ │ │ project_page.html
│ │ │
│ │ ├───search
│ │ │ search.html
│ │ │
│ │ ├───services
│ │ │ service_index_page.html
│ │ │ service_page.html
│ │ │ service_pillar_page.html
│ │ │ working_area_page.html
│ │ │
│ │ ├───_blocks
│ │ │ blockquote.html
│ │ │ carousel_block.html
│ │ │ lightbox_block.html
│ │ │ linked_asset_block.html
│ │ │ paragraph_block.html
│ │ │ people_list_block.html
│ │ │ related_assets_block.html
│ │ │ spacer_block.html
│ │ │
│ │ ├───_includes
│ │ │ │ card.html
│ │ │ │ card_new.html
│ │ │ │ card_old.html
│ │ │ │ card_people.html
│ │ │ │ card_video.html
│ │ │ │ card_with_col.html
│ │ │ │ index_item_search.html
│ │ │ │ index_item_specific_cards.html
│ │ │ │ ld_article.html
│ │ │ │ ld_article.json
│ │ │ │ ld_organization.html
│ │ │ │ ld_organization.json
│
├───index
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ __init__.py
│
├───knowledge
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ __init__.py
│
├───news
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ __init__.py
│
├───people
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ __init__.py
│
├───projects
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ __init__.py
│
├───search
│ │ apps.py
│ │ models.py
│ │ translation.py
│ │ views.py
│ │ __init__.py
│
└───services
│ apps.py
│ models.py
│ translation.py
│ __init__.py