Skip to main content

Django CMS for presentation websites

Project description

PyPI version Code style: black

Django Xprez

Xprez is CMS For Django

Quick start

  1. Install django-xprez:
    pip install django-xprez
  1. Add following apps to your settings.INSTALLED_APPS:
    INSTALLED_APPS = [
        ...
        'django.contrib.humanize',
        'sorl.thumbnail',
        'xprez',
        'xprez.ck_editor',
        ...
    ]
  1. Run python manage.py migrate to create xprez models.

  2. Make sure request context processor is enabled in settings:

    TEMPLATES = [
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'django.template.context_processors.request',
                ...
            ]
        },
        ...
    ]
  1. Include the xprez admin URLconf in your project urls.py like this:
    path('xprez/', include('xprez.urls')),
  1. Create models:
    from xprez.models import ContentsContainer

    class Page(ContentsContainer):
        title = models.CharField(max_length=255)
        slug = models.SlugField(max_length=255, unique=True)

        def __str__(self):
            return self.title
  1. Register models in admin:
    from django.contrib import admin
    from xprez.admin import XprezAdmin
    from .models import Page

    @admin.register(Page)
    class PageAdmin(XprezAdmin):
        pass
  1. Render page in template:
    {% load xprez %}
    {% xprez_front_media %}
    {% include 'xprez/includes/photoswipe.html' %}
    {% include 'xprez/container.html' with contents=page.contents.all %}
  1. (optional) Change sorl thumbnail backend in settings - for seo-friendly thumbnail filenames:
    THUMBNAIL_BACKEND = 'xprez.contrib.sorl_thumbnail.thumbnail_backend.NamingThumbnailBackend'
  1. (optional) Look at example_app for more comprehensive example.

Development

To setup automated black formatting connected to git commits:

To rebuild ckeditor:

cd xprez/ck_editor/assets/ckeditor5
npm install
npm run build

To rebuild css styles

cd xprez/static/xprez
npm install
npm run build (or `watch` for developing)

Deploying new version

https://github.com/s-cape/django_xprez/actions/workflows/release.yml

TODO

  • add custom module tutorial to Readme
  • fix template content to save only relative path to database
  • check template content raising UnicodeDecodeError
  • create manual for various situations (ck_editor branch)
    • using custom config and implement style sources into own building system (using get_module_path.py)
    • how to implement xprezanchor functionality

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_xprez-0.2.35.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_xprez-0.2.35-py3-none-any.whl (3.8 MB view details)

Uploaded Python 3

File details

Details for the file django_xprez-0.2.35.tar.gz.

File metadata

  • Download URL: django_xprez-0.2.35.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for django_xprez-0.2.35.tar.gz
Algorithm Hash digest
SHA256 1c3a8fb8d907bd07a198d6e88ea718f636054b8600c242815b23925d67ed182a
MD5 b7a1314d6a06188c9694ba88486f0aae
BLAKE2b-256 b0ba8bca5857a82d8b31f0d845f7cb7692540c24a10a26a8168be59df98d3f8c

See more details on using hashes here.

File details

Details for the file django_xprez-0.2.35-py3-none-any.whl.

File metadata

  • Download URL: django_xprez-0.2.35-py3-none-any.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for django_xprez-0.2.35-py3-none-any.whl
Algorithm Hash digest
SHA256 a61ebcf7a49f84cbe4dfc734f1cf461a3b4a71950112a3942af9acf3445d5c30
MD5 29a89ff10db35ed35decb2f690d39ef9
BLAKE2b-256 2dd0d7e55d27c0f80426260ede1e3d5246df7b6b7a2dd06c224e754d0f6d01eb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page