我的目的是将现有项目中的静态页面(关于我们,联系我们等)转换为管理可编辑页面。我已按照tutorial的说明开始操作,但似乎没有任何结果。到目前为止,表现python manage.py cms check
似乎表明我已经完成了所有设置。但我似乎没有正确的网址。它在这里说
你需要在你的结尾加入'cms.urls'urlpatterns urlpatterns的。
我的网址如下:
urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
# Main site
url(r'^', include('website.urls')),
url(r'^', include('cms.urls')),
)
if settings.DEBUG:
import debug_toolbar
urlpatterns = patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'', include('django.contrib.staticfiles.urls')),
url(r'^__debug__/', include(debug_toolbar.urls)),
) + urlpatterns
当我输入http://localhost:8000?edit
时,cms工具栏/菜单没有显示出来。继承我下面创建的模板的页面也没有显示任何占位符进行编辑,当我使用?edit后缀url时。
知道我哪里出错了吗?
{% load cms_tags sekizai_tags %}
<!doctype html>
<html>
<head>
{% include "head.html" %}
{% block page_specific %}
{% endblock %}
{% render_block "css" %}
{% render_block "js" %}
</head>
<body>
<!--{% include "floating_login.html" %}-->
<section id="subpage_wrapper">
{% with include_ribbon=1 %}
{% include "nav_base.html" %}
{% endwith %}
<div id="sub_wrapper_white">
{% placeholder "feature" %}
{% block static_content %}
{% endblock static_content %}
</div>
<div id="sub_wrapper_red"></div>
<div id="sub_wrapper_yellow"></div>
</section>
</body>
</html>
答案 0 :(得分:0)
两件事,删除,我认为是什么,你的项目网址可能会导致一些问题。但是如果你需要它,不要只是匹配基本模式,因为我认为这是不好的做法,直到你在该文件中做了很多特定的模式匹配,这些匹配不太可能破坏CMS URL。
然后将{% cms_toolbar %}
标记添加到基本模板,以确保工具栏显示&amp;您可以与CMS进行互动。
urls.py
urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
# Main site
url(r'^project/', include('website.urls')),
url(r'^', include('cms.urls')),
)
base.html
{% load cms_tags sekizai_tags %}
<!doctype html>
<html>
<head>
{% include "head.html" %}
{% block page_specific %}
{% endblock %}
{% render_block "css" %}
{% render_block "js" %}
</head>
<body>
{% cms_toolbar %}
<!--{% include "floating_login.html" %}-->
<section id="subpage_wrapper">
{% with include_ribbon=1 %}
{% include "nav_base.html" %}
{% endwith %}
<div id="sub_wrapper_white">
{% placeholder "feature" %}
{% block static_content %}
{% endblock static_content %}
</div>
<div id="sub_wrapper_red"></div>
<div id="sub_wrapper_yellow"></div>
</section>
</body>
</html>