How to create a django CMS application with our quickstart repository#
It uses a standard, minimal django CMS application as modelled on that created by the django CMS installer.
The only additions are a few lines of glue code in
settings.py to handle configuration using environment variables,
plus some additional files to take care of the Docker set-up.
The application includes some (clearly-indicated) options for popular components (such as Django Filer) and also a Bootstrap 4 frontend. These can quickly be removed if you prefer a more minimal application to work with.
Clone the repository#
git clone firstname.lastname@example.org:divio/django-cms-divio-quickstart.git
The application contains a module named
settings.py and other application-level
Removing optional components#
requirements.txt files contain sections that can be removed if you do not require the
functionality they provide - in each case, the section is noted with a comment containing the word optional. You will
need to make sure that you remove the corresponding sections from both files if you do.
The options include:
components typically used with django CMS (CKEditor, Django File, django CMS Admin Style)
some popular basic content plugins
components and templates required for a Bootstrap 4 frontend
quickstart application module (optional)#
If you’d like this to be named something else, now is the time to change the directory name, along with the references
quickstart module wherever it appears, which is in:
Using MySQL or an alternative gateway server#
By default, the application uses Postgres and uWSGI, but MySQL and other gateway server options are available.
You’ll need to change a few lines of configuration to achieve this across a few files. See the notes for each:
Run the application locally#
This section assumes that you have Docker and the Divio CLI installed. You also need an account on Divio, and your account needs your SSH public key. See How to set up the Divio local development environment if required.
Build the Docker image#
Run database migrations and create a superuser#
docker-compose run web python manage.py migrate
(Note that due to Docker behaviour, you may get an error the first time you run this - Docker can sometimes be too slow to start up the database in time. If this happens, simply run the command again.)
docker-compose run web python manage.py createsuperuser
Launch the local server#
Try accessing the site at http://127.0.0.1:8000/ (this will only work if a URL has been wired up to /).
The Django admin is available at http://127.0.0.1:8000/admin.
You now have a working, running application ready for further development. All the commands you might normally execute
in development need to be run inside the Docker container - prefix them with
docker-compose run web as in the
You can also use
docker-compose run web bash to get a bash prompt for an interactive session inside the container.
See Working with our recommended Django application configuration for further guidance.
Your application is ready for deployment on our cloud platform. The basic steps are:
create an application on the Divio Control Panel, with any required services
push your code/connect your Git repository
deploy one or more cloud environments
These steps are covered in more detail in Deploy your application to Divio.