This setup is outdated as there are Mezzanine 4 and Django 1.8 versions. Any suggestions and pull requests for new setup are wellcome.


Openshift does not currently process python dependencies correctly. One must perform pip install <library> from within Openshift SSH shell, where library is every item in install_requires in file.

I do not know, when this issue will be resolved.


The latest Mezzanine with Django configured to work on Redhat Openshift (

Includes the convenient backup cron script for DB and media files.

Additionaly includes wwwroot with favicon.ico and robots.txt for adjustement.

Requirements Status

Quick info

The concept is to merge 3 sources together:

  1. openshift python application project files
  2. adjustements from this repo (incl. Mezzanine template project files)
  3. your creations within Mezzanine project

The principles:

  • minimum adjustements needed
  • being able to run the application on local dev PC and server environment without file juggling
  • change behaviour via environment variables (e.g. DEBUG)


No changes needed for the local development. Use your on development PC as adviced by Mezzanine project.

No changes needed for the Openshift environment. The file is set in general to use the Openshift provided parameters.

Backups daily with files retention. I.e. daily backups are stored 14 days, weekly 60 days, monthly 300 days. Other backups are deleted in order to preserve the storage.

Quick intro for Openshift people

(full instructions bellow)

  1. If you already have, copy you mezzanine project files under wsgi directory.

  2. Adjust your custom Django / Mezzanine settings in the and additional dependencies in

  3. And git push or sftp your changes to Openshift.

  4. Wait a while, then SSH into Openshift and execute the DB initialization (see bellow)

  5. Enjoy

Under wsgi subfolder these files are crucial for the Mezzanine working on the Openshift:

  • application (runs the Mezzanine under the Apache web process)
  • (adjusted to recognize local PC vs the Openshift environment)
  • (your own settings)

Under wsgi/wwwroot subfolder you can safely replace all files.

Other files are just stock Mezzanine project files.

Backup feature requires cron cartridge.

Run ít on local PC

cd into the wsgi directory

run: python runserver

The sqlite database will be created in wsgi directory, DEBUG will be on.


DEBUG settings are implicitly False when deployed on Openshift and True on local PC development (auto setup). Additionally it is controlled by the environment variable DJANGO_DEBUG.

Set it on Openshift:

  • via ssh@openshift: export DJANGO_DEBUG=True

  • or using rhc from local PC: rhc env-set DJANGO_DEBUG=True --app <appname>

Full instructions for setup

Create new account on Redhat Openshift ( ), install your rhc tools on local PC (follow the instructions on the Openshift website).

On local PC CD into the directory where you want to work with your application

cd (my dir)

Create application and cd into the created dir (replace mezzanine with the name of your app)

rhc app create mezzanine python-2.7 postgresql-9.2 cron-1.4
cd mezzanine

Delete not needed or conflicting files

del *

Pull the adjustements

git remote add mezzanineopenshift -m master
git pull -s recursive -X theirs mezzanineopenshift master

If you are on Windows, check and assure that the Openshift deployment hooks and backup scripts are executable

git ls-tree master .openshift/action_hooks/
git ls-tree master .openshift/cron/daily/

This should show 100755 at the beginning of build, deploy and files, if not fix it:

git update-index --chmod=+x .openshift\action_hooks\build
git update-index --chmod=+x .openshift\action_hooks\deploy
git update-index --chmod=+x .openshift\cron\daily\

Optionaly adjust your dependencies in the

Commit changes

git add -A
git commit -m "initial mezzanine deploy"

Push to openshift

git push origin

Now you can wait for a while for all dependencies to be downloaded on Openshift's server. It might report some warnings. Then follow with DB initialization on Openshift.

DB @ Openshift initialization

SSH login to openshift application (replace mezzanine with the name of your app)

rhc ssh mezzanine --ssh="c:\git\bin\ssh.exe" 
cd app-root/repo/wsgi/
python createdb
python migrate

Check via browser your fresh Mezzanine installation :)

Other info

The OpenShift python cartridge documentation can be found at:

Cron cartridge documentation

Special setup

Apache Status Page

Put the empty file named enable_public_server_statusmarker in your .openshift/markers/ directory to enable the Apache status page at URI /server-status