Oh yea, this is a bit of a longer one today that we are looking at.
I have a current website https://quick-time-management.com which is a great tool to keep you on track and see what you actually have done through out the day and I want to setup a blog for it for content.
Currently it's running Django, pretty happily :) and we want to add Django-CMS to it.
Checkout the youtube video for this one at
Django cms
https://docs.django-cms.org/en/latest/how_to/install.html
############################################################################
Requirements
############################################################################
pip freeze> requirement.txt
Add to requirements.txt file
####################
Django==3.2
# djang cms installs
django-cms
django-treebeard
django-sekizai
django-classy-tags
djangocms-admin-style
six
Pillow
django-filer
cmsplugin-filer
django-reversion
djangocms-text-ckeditor
djangocms-link
djangocms-file
djangocms-picture
djangocms-video
djangocms-googlemap
djangocms-snippet
djangocms-style
pip install -r requirements.txt
############################################################################
# make app
############################################################################
python manage.py startapp blog
############################################################################
# create tempplates folder and template_1.html
############################################################################
{% load cms_tags sekizai_tags %}
<html>
<head>
<title>{% page_attribute "page_title" %}</title>
{% render_block "css" %}
</head>
<body>
{% cms_toolbar %}
{% placeholder base_content %}
{% block base_content %}{% endblock %}
{% render_block "js" %}
</body>
</html>
############################################################################
# Settings.py
############################################################################
# Application definition
INSTALLED_APPS = [
'djangocms_admin_style', # for the admin skin. You **must** add 'djangocms_admin_style' in the list **before** 'django.contrib.admin'.
# app
# app
# app
# django-cms installs
'blog',
'django.contrib.sites',
'cms', # django CMS itself
'menus', # helper for model independent hierarchical website navigation
'treebeard', # utilities for implementing a tree
'sekizai', # for JavaScript and CSS management
'filer',
'easy_thumbnails',
'mptt',
'djangocms_text_ckeditor',
'djangocms_link',
'djangocms_file',
'djangocms_picture',
'djangocms_video',
'djangocms_googlemap',
'djangocms_snippet',
'djangocms_style',
]
MIDDLEWARE = [
'cms.middleware.utils.ApphookReloadMiddleware', # django-cms
# app
# app
# django-cms
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'django.middleware.locale.LocaleMiddleware'
]
TEMPLATES
# app
# app
# django-cms
'cms.context_processors.cms_settings',
'sekizai.context_processors.sekizai',
],
############################################################################
At the bottom of settings.py
############################################################################
# Django cms
SITE_ID = 2
LANGUAGES = [
('en-us', 'English'),
]
CMS_TEMPLATES = (
('template_1.html', 'Template One'),
# ('layouts/default.html', 'Template One'),
)
THUMBNAIL_HIGH_RESOLUTION = True
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters'
)
MEDIA_ROOT = os.path.dirname(BASE_DIR) + '/public/media/'
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
############################################################################
# urls.py
############################################################################
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.static import serve
re_path(r'^', include('cms.urls')),
]
if settings.DEBUG or settings.DEBUG == False:
urlpatterns = [
url(r'^media/(?P<path>.*)$', serve,
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
] + staticfiles_urlpatterns() + urlpatterns
############################################################################
base.html
############################################################################
{% load static cms_tags sekizai_tags %}
{% render_block "css" %}
<head>
<title>
quick-time-management.com - {% block title %}{% endblock %}{% page_attribute "page_title" %}
</title>
{% render_block "css" %}
</head>
<body>
<!-- django-cms -->
{% cms_toolbar %}
{% placeholder "content" %}
{% render_block "js" %}
</body>
############################################################################
# test migrate and runserver
############################################################################
python manage.py migrate
python manage.py cms check
python manage.py runserver