Probably the smallest and simplest CMS for Django.
While it is extremely simple, it supports some features that I haven't found in other CMS frameworks. Namely you can create pages for multiple languages but also for multiple locations or any conbination of both.
-
Use pip to instal the latest stable release
pip install django-copy
You can also install a local copy by running
setup.py install
at the top directory of django-copy -
Add
djangocopy
and it's dependencies toINSTALLED_APPS
in the project settings (see dependencies below)'ckeditor', 'ckeditor_uploader', 'filer' 'easy_thumbnails', 'simple_history', 'djangocopy',
-
Add
djangocopy.middleware.LocalisationMiddleware
toMIDDLEWARE
in the project settings file (OR see alternative further below)
-
If not set already, set
MEDIA_ROOT
andMEDIA_URL
in settings. For example:MEDIA_ROOT = BASE_DIR.joinpath('media') MEDIA_URL = '/media/'
-
Also in settings, create
DJANGOCOPY_TEMPLATES
andDJANGOCOPY_IMAGES
to define where uploaded template and imagefiles are stored. These paths will sit belowMEDIA_ROOT
so add the media folder to theDIRS
list inTEMPLATES
to make it searchable by the Django template framework. For example:DJANGOCOPY_TEMPLATES = 'copy/templates/' DJANGOCOPY_IMAGES = 'copy/images/' TEMPLATES[0]['DIRS'] += [MEDIA_ROOT]
-
In urls.py add
path('ckeditor/', include('ckeditor_uploader.urls')), path('accounts/', include('django.contrib.auth.urls')), path('filer/', include('filer.urls')), path('djangocopy/', include('djangocopy.urls')),
Django-copy depends on the following packages that need to be installed separately
```
markdown
django-simple-history
django-ckeditor
django-ckeditor-filer
```
to configure these please add the following sample configuration in settings:
```
# django.contrib.auth settings
#
LOGIN_URL = '/accounts/login'
LOGIN_REDIRECT_URL = '/djangocopy/sample'
LOGOUT_REDIRECT_URL = '/accounts/login'
# CKEditor
#
CKEDITOR_BASEPATH = "{}ckeditor/ckeditor/".format(STATIC_URL)
CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_CONFIGS = {
# as required...
}
```
By default djangocopy/wrapper.html
is used to wrap user content and provide basic settings. You can override this template in
the usual Django way.
If you follow the steps above, all views in the project will get access to the content stored in the djangocopy app. That carries
a small overhead so if you want to avoid that you can instead add @decorator_from_middleware(LocalisationMiddleware)
to each of
the views that will require access to DB stored content. For example:
```
from django.utils.decorators import decorator_from_middleware
from djangocopy.middleware import LocalisationMiddleware
@decorator_from_middleware(LocalisationMiddleware)
def my_view
...
```
djangocopy can localise the IP address requesting a page and adapt the output depending on where the request comes from (as well as which language is the broser set to).
To enable this functionality, install the database files from Maxmind at https://www.maxmind.com/en/geoip2-databases in a folder of
your choice and add GEOIP_PATH
to the settings pointing to that folder
for example:
```
GEOIP_PATH = BASE_DIR.joinpath('assets', 'geoip')
```
The examples
folder contains simple examples and can be used as a template for a new site. A pre-populated sqlite3 database
is included in the distribution but you still need to load the sample.html
file into the sample
template for the test
site to work.
Generally, the workflow for creating a new site is to go to the admin panel and then:
- Create one or more templates (you can start with
djangocopy/templates/sample.html
as in the exmaple provided) - Create one or more pages that depend on those templates
- Populate the copy for those templates (for the sample above create a plaintex entry called
paragraph
and a JSON list or strings calledlistitems
) - Done!
You can go further and setup a navbar as well. the navbar system is fairly complex and allows different user groups to see different navbars (which can be combined in a user defined order). Defining a navbar relies on setting up a JSON list-of-dicts element with each item in the list containing the various parameters of each navbar entry. Icons and dropdowns are supported. the URLs can be relative, absolute or named URLs. Here is a fairly complex example and you can find slightly more complex examples in the sqlite3 database that comes with the sample site:
```
[
{
"label": "Sample",
"url": "/djangocopy/sample",
"faicon": "dashboard"
},
{
"label": "Tools",
"faicon": "cogs",
"dropdown": [
{
"label": "Board",
"url": "/djangocopy/live"
},
{
"label": "Pipeline",
"url": "/djangocopy/pipeline",
"divider": 1
},
{
"label": "Search",
"url": "/djangocopy/clients"
}
]
}
]
```
This product depends on the following software and media packages
Font Awesome fonts version 4.7 is licensed under SIL OFL 1.1 and the MIT License
Bootstrap version 4.0 is licensed under the MIT License
GeoLite2 data created by MaxMind, available from http://www.maxmind.com