Django Markdown CMS: A markdown flat-file based CMS for Django.
pip install git+https://github.com/FlipperPA/django-md-cms.git
INSTALLED_APPS += ('md_cms',)
Settings example:
MD_CMS_ROOT = '/var/md_cms_content'
MD_CMS_DEFAULT_FILE = 'index.md'
MD_CMS_EDIT_SUFFIX = 'edit'
This example shows how to have django-md-cms control all the content for your site.
django-admin.py startproject myproject
pip install django-md-cms
cd myproject && python manage.py migrate
python manage.py createsuperuser
Then, edit your uls.py
file, to look something like this:
from django.conf.urls import include, url
from django.contrib import admin
from md_cms.views import MdCMSView
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^([A-Za-z0-9-/]*)/$', MdCMSView.as_view(), name='viewpage'),
url(r'^([A-Za-z0-9-/]*)/' + settings.MD_CMS_EDIT_SUFFIX + '$', MdCMSEdit.as_view(), name='editpage'),
]
This set of patterns first looks for the Django Admin, then for any HTTP_INFO pattern matching any letter (upper or lowercase), a hyphen ('-'), or a foreward slash ('/'). These will result in the creation of valid system paths and files.
Trailing slashes matter in your URLs! The way the logic is constructed is as follows:
DJANGO_MD_CMS_ROOT + '/this-page.md'
DJANGO_MD_CMS_ROOT + '/this-page/'
and a file named DJANGO_MD_CMS_ROOT + '/this-page/index.md'
{% md-cms "about/welcome.md" %}