This is an instance of django CMS used to build d120.de.
A quick development setup is much simpler than the whole installation for production. Just do the following steps to get a local instance running:
git clone THIS_REPO
cd djangocms
virtualenv -p python3 venv
source venv/bin/activate
script/update
./manage.py createsuperuser
./manage.py runserver
To test functionality that needs a TLS capable server, one can run ./manage.py runsslserver
.
Note that some of the required Python packages have other dependencies, e.g. to C libraries which one can install using the distribution's package manager. Which exactly can differ but starting a web search when pip install shows an error typically gives good results. Additionally, npm must be installed for frontend dependency management.
By default, the settings.py
file is used which is suitable for a development setup. To have a proper deployment on production, one should use the settings_production.py
file (which imports the default, overrides certain preferences, and reads secrets from settings_secrets.py
). This means:
--settings d120.settings_production
option to certain manage.py
commandsexport DJANGO_SETTINGS_MODULE=d120.settings_production
to set the environment variable before running multiple manage.py
commandscd /srv
, git clone THIS_REPO
cd djangocms
, virtualenv -p python3 venv
(and maybe update pip and setuptools)mysql -u root
create database djangocms;
grant all on djangocms.* to djangocms@localhost identified by DB_PASSWORD;
quit
d120/settings_secrets.py
(copy from d120/settings_secrets.py.sample
) and fill it with the necessary secrets (it is a good advice to restrict read permissions from others)chown -R djangocms:djangocms .
sudo -u djangocms script/update --prod
uwsgi-djangocms.ini
contains an exemplary uwsgi configurationAll necessary steps to update from this repository can be found in script/update
. Just go into the project folder and run the script.
script/update
sudo -u djangocms script/update --prod
Since our requirements.txt
does not pin versions of additional packages, it might happen that a third party package receives an update which breaks compatibility. In this case, have a look on the output of the script, roll back the affected package and/or investigate what is going on.
To install security or bugfix updates, it should be enough to follow the instructions from above, due to the loose version pinning in requirements.txt
. This is done to avoid keeping track of releases of all the installed packages. Pinning them would lead to a poorly updated installation.
However, major updates from additional packages can break compatibility, see notes above for this. If it seems necessary to pin the version of an additional package, make this a temporary solution and add a comment in requirements.txt
explaining the reason.
The version of the django-cms package itself is restricted to a major release, so only compatible updates are installed without touching the requirements.txt
. When a new major version becomes available, one might want to test this locally before changing the restriction and deploying the update on production. The official django CMS documentation should include important information in the release notes section!
The same holds true for the Django framework. Maybe it is a good idea to stick with LTS releases.
Before and after changing major versions, use the script/check
wrapper script to check the project for potential problems (such as deprecations). Note that it may also output warnings in third party packages.
Additionally, from time to time one should look for updated versions of the frontend dependencies listed in package.json
.