django-cms / django-cms-quickstart

A Dockerised django CMS project, ready to deploy on Divio or another Docker-based cloud platform, and run locally in Docker on your own machine. A Divio account is not required.
https://docs.django-cms.org/en/latest/introduction/01-install.html
MIT License
99 stars 335 forks source link
djangocms docker quickstart

|pythonapp|

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

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

Requirements

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

Local Setup

.. 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 --rm web python manage.py migrate docker compose run --rm 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.

You can stop the server with docker compose stop without destroying the containers and restart it with docker compose start.

With docker compose down the containers are deleted, but the database content is still preserved in the named volume django-cms-quickstart_postgres-data and the media files are stored in the file system in data/media. Then you can update the project e. g. by changing the requirements and settings. Finally you can rebuild the web image and start the server again:

.. code-block:: bash

docker compose build web docker compose up -d

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-do-not-remove

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 django best practise two step approach, freezing all dependencies with pip-tools. Here is how to update requirements:

  1. Change requirements.in according to your needs. There is no need to pin the package versions here unless you have a good reason (i.e. known incompatibilities)
  2. Run docker compose run --rm web pip-compile requirements.in >> requirements.txt
  3. requirements.txt should now have changed
  4. Rebuild the container docker compose build web and restart docker compose up -d

Features ########

Static Files with Whitenoise

Env variables

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

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

Deployment ##########

Note that this is just a demo project to get you started. It is designed to be run locally through docker. 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.

Some deployment hints:

Deployment Commands

Configure your hosting environment to run the following commands on every deployment:

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.

.. |pythonapp| image:: https://github.com/django-cms/django-cms-quickstart/workflows/Python%20application/badge.svg?branch=support/cms-4.1.x