Skip to content
3 changes: 1 addition & 2 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, pypy3]
python-version: [3.9, "3.10", "3.11", pypy3]
os: [
ubuntu-20.04,
ubuntu-18.04,
]

services:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9
FROM python:3.10
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
Expand Down
79 changes: 0 additions & 79 deletions README.md

This file was deleted.

96 changes: 96 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
![Python application](https://github.com/django-cms/django-cms-quickstart/workflows/Python%20application/badge.svg?branch=main)

django CMS quickstart
#####################

A Dockerised django CMS project, ready to deploy on `Divio <https://www.divio.com/>`_ or another Docker-based cloud platform, and run locally in Docker on your own machine.

This version uses Python 3.10 running and the most up-to-date versions of Django 3.2, and django CMS 4.1.0rc1

This project is endorsed by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_. That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy. Join us on `Slack <https://www.django-cms.org/slack/>`_ for more information or questions.

The documentation for version 4.1 is still work in progress and - for the time being - can be found here: https://django-cms-docs.readthedocs.io/en/latest/

Installation
############

You need to have docker installed on your system to run this project.

- `Install Docker <https://docs.docker.com/engine/install/>`_ here.
- If you have not used docker in the past, please read this `introduction on docker <https://docs.docker.com/get-started/>`_ here.

Try it
######

.. inclusion-marker-do-not-remove

.. code-block:: bash

git clone git@github.com:django-cms/django-cms-quickstart.git
cd django-cms-quickstart
docker compose build web
docker compose up -d database_default
docker compose run web python manage.py migrate
docker compose run web python manage.py createsuperuser
docker compose up -d

Then open http://django-cms-quickstart.127.0.0.1.nip.io:8000 (or just http://127.0.0.1:8000) in your browser.

Note: Since Compose V2, `docker-compose` is now included inside docker. For more information, checkout the `Compose V2 <https://docs.docker.com/compose/cli-command/>`_ Documentation.

.. inclusion-end-marker

Customising the project
#######################

This project is ready-to-go without making any changes at all, but also gives you some options.

As-is, it will include a number of useful django CMS plugins and Bootstrap 4 for the frontend. You don't have to use
these; they're optional. If you don't want to use them, read through the `settings.py` and `requirements.txt` files to
see sections that can be removed - in each case, the section is noted with a comment containing the word 'optional'.

Options are also available for using Postgres/MySQL, uWSGI/Gunicorn/Guvicorn, etc.

#### Updating requirements

The project uses a 2 step approach, freezing all dependencies with pip-tools. Read more about how to handle it here: https://blog.typodrive.com/2020/02/04/always-freeze-requirements-with-pip-compile-to-avoid-unpleasant-surprises/

Features
########

Static Files with Whitenoise
============================

This quickstart demo has a cloud-ready static files setup via django-whitenoise.

In the containerized cloud the application is not served by a web server like nginx but directly through uwsgi. django-whitenoise is the glue that's needed to serve static files in your application directly through uwsgi.

See the django-whitenoise settings in settings.py and the `quickstart/templates/whitenoise-static-files-demo.html` demo page template that serves a static file.

Contribution
############

Here is the official django CMS repository: https://github.com/django-cms/django-cms-quickstart/


Deployment
##########

Note that this is just a demo project to get you started. If you want a full production ready site with all the bells and whistles we recommend you have a look at https://github.com/django-cms/djangocms-template instead.

Env variables
=============

- to deploy this project in testing mode (recommended) set the environment variable `DEBUG` to ``True`` in your hosting environment.
- For production environment (if ``DEBUG`` is false) django requires you to whitelist the domain. Set the env var ``DOMAIN`` to the host, i.e. ``www.domain.com`` or ``*.domain.com``.
- If you want the media hosted on S3 set the ``DEFAULT_FILE_STORAGE`` variable accordingly.

#### Deployment Commands
Configure your hosting environment to run the following commands on every deployment:
- ``./manage.py migrate``


Divio Deployment
================

divio.com is a cloud hosting platform optimized for django web applications. It's the quickest way to deploy this project. Here is a `video tutorial <https://www.youtube.com/watch?v=O2g5Wfoyp7Q>`_ and a `description of the deployment steps <https://github.com/django-cms/djangocms-template/blob/mco-standalone/docs/deployment-divio.md#divio-project-setup>`_ that are mostly applicable for this quickstart project.
50 changes: 30 additions & 20 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,30 @@

# the default alias content - optional, but used in most projects
'djangocms_alias',
'parler',

# the default CKEditor - optional, but used in most projects
'djangocms_text_ckeditor',

'djangocms_url_manager',

'djangocms_picture',

# optional django CMS Bootstrap 4 modules
'djangocms_bootstrap4',
'djangocms_bootstrap4.contrib.bootstrap4_alerts',
'djangocms_bootstrap4.contrib.bootstrap4_badge',
'djangocms_bootstrap4.contrib.bootstrap4_card',
# 'djangocms_bootstrap4.contrib.bootstrap4_carousel', # TODO: remove hard-coded dependance on djangocms_link
'djangocms_bootstrap4.contrib.bootstrap4_collapse',
'djangocms_bootstrap4.contrib.bootstrap4_content',
'djangocms_bootstrap4.contrib.bootstrap4_grid',
'djangocms_bootstrap4.contrib.bootstrap4_jumbotron',
# 'djangocms_bootstrap4.contrib.bootstrap4_link', # TODO: remove hard-coded dependance on djangocms_link
'djangocms_bootstrap4.contrib.bootstrap4_listgroup',
'djangocms_bootstrap4.contrib.bootstrap4_media',
'djangocms_bootstrap4.contrib.bootstrap4_picture',
'djangocms_bootstrap4.contrib.bootstrap4_tabs',
'djangocms_bootstrap4.contrib.bootstrap4_utilities',
'djangocms_frontend',
'djangocms_frontend.contrib.accordion',
'djangocms_frontend.contrib.alert',
'djangocms_frontend.contrib.badge',
'djangocms_frontend.contrib.card',
'djangocms_frontend.contrib.carousel',
'djangocms_frontend.contrib.collapse',
'djangocms_frontend.contrib.content',
'djangocms_frontend.contrib.grid',
'djangocms_frontend.contrib.jumbotron',
'djangocms_frontend.contrib.link',
'djangocms_frontend.contrib.listgroup',
'djangocms_frontend.contrib.media',
'djangocms_frontend.contrib.image',
'djangocms_frontend.contrib.tabs',
'djangocms_frontend.contrib.utilities',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -124,14 +124,22 @@
},
]

THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
#'easy_thumbnails.processors.scale_and_crop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)

CMS_TEMPLATES = [
# a minimal template to get started with
('minimal.html', 'Minimal template'),
('whitenoise-static-files-demo.html', 'Static File Demo'),

# optional templates that extend base.html, to be used with Bootstrap 5
('page.html', 'Bootstrap 4 Demo'),
('feature.html', 'Bootstrap 4 Demo with two placeholders')
('bootstrap5.html', 'Bootstrap 5 Demo'),

('whitenoise-static-files-demo.html', 'Static File Demo'),
]

WSGI_APPLICATION = 'backend.wsgi.application'
Expand Down Expand Up @@ -211,3 +219,5 @@
SITE_ID = 1

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

CMS_CONFIRM_VERSION4 = True
67 changes: 32 additions & 35 deletions backend/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
{% load cms_tags static sekizai_tags menu_tags %}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}This is my new project home page{% endblock title %}</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> -->
{% render_block "css" %}
<!DOCTYPE html>{% load cms_tags menu_tags sekizai_tags static i18n %}{% spaceless %}
<html lang="{{ LANGUAGE_CODE }}">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
{% block meta %}
<meta name="description" content="{% page_attribute meta_description %}"/>
<meta property="og:type" content="website"/>
<meta property="og:title" content="{% page_attribute "page_title" %}"/>
<meta property="og:description" content="{% page_attribute meta_description %}"/>
{% endblock meta %}
{% block canonical_url %}
<link rel="canonical" href="{{ request.build_absolute_uri }}"/>
<meta property="og:url" content="{{ request.build_absolute_uri }}"/>
{% endblock canonical_url %}
{% block fb_meta %}{% endblock fb_meta %}
<title>{% block title %}{% page_attribute "page_title" %}{% endblock %}</title>
{% block base_css %}{% endblock %}
{% endspaceless %}{% render_block 'css' %}{% spaceless %}
{% block page_head %}{% endblock %}
</head>
<body>
{% cms_toolbar %}
<div class="container-fluid">
<div class="navbar navbar-light bg-light" role="navigation">
<div class="navbar-header">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="/">Project name</a>
</div>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
{% show_menu 0 1 100 100 "menu.html" %}
</ul>
</div>
</div>
{% block content %}{% endblock content %}
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> -->
{% render_block "js" %}
<body {% block body_attrs %}{% endblock %}>
{% endspaceless %}{% cms_toolbar %}{% spaceless %}
{% block navbar %}{% endblock %}
{% block content %}
{% placeholder "Content" %}
{% endblock content %}
{% block base_js %}{% endblock %}
{% endspaceless %}{% render_block 'js' %}{% spaceless %}
{% block end_js %}{% endblock %}
{% block bottom_css %}{% endblock %}
</body>
</html>
</html>{% endspaceless %}
21 changes: 21 additions & 0 deletions backend/templates/bootstrap5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends "base.html" %}{% load cms_tags menu_tags %}
{% block base_css %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous"/>
{% endblock %}
{% block base_js %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
{% endblock %}
{% block navbar %}
<nav class="navbar {% block navbar_options %}navbar-expand-lg navbar-dark bg-dark{% endblock %}">
<div class="container">
<a class="navbar-brand" href="/">{% block brand %}{% endblock %}</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">{% block menubar %}{% show_menu 0 100 0 100 'menu/menu.html' %}{% endblock %}</ul>
{% block searchbar %}{% endblock %}
</div>
</div>
</nav>
{% endblock %}
13 changes: 0 additions & 13 deletions backend/templates/feature.html

This file was deleted.

Loading