skip to navigation
skip to content

djaodjin-deployutils 0.4.7

Management commands to deploy Django webapps

DjaoDjin deployutils

This Django app enables a Django project to seamlessly integrate behind
the [DjaoDjin HTTP session manager reverse proxy](
It will replace the default ``django.contrib.sessions``
and ``AUTHENTICATION_BACKENDS`` to decode sessions forwarded to your Django
project by the HTTP session manager.


Install deployutils into your environment

$ pip install djaodjin-deployutils

Update your

+from deployutils.configs import load_config

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+APP_NAME = os.path.basename(BASE_DIR)

load_config(APP_NAME, 'credentials', verbose=True))

+ 'deployutils.apps.django',

- 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'deployutils.apps.django.middleware.SessionMiddleware',

+ 'deployutils.apps.django.backends.auth.ProxyUserBackend',

# Session settings
+SESSION_ENGINE = 'deployutils.apps.django.backends.encrypted_cookies'

+ # Hardcoded mockups here.
+ 'donny': {
+ 'username': 'donny',
+ 'roles': {
+ 'manager': [{
+ 'slug': 'testsite', 'printable_name': 'Testsite'}]}},
+ },
+ STATIC_URL, reverse_lazy('login')]

Create a ``credentials`` file that contains the ``DJAODJIN_SECRET_KEY``

$ cat ./credentials
# Authentication for djaodjin firewall
DJAODJIN_SECRET_KEY = "__your_secret_key__"

(for stand-alone testing) Add the mockup views in

urlpatterns = [
+ url(r'^', include('deployutils.apps.django.mockup.urls')),


Clone the repository in a virtualenv and install the prerequisites

$ virtualenv-2.7 _installTop_
$ cd _installTop_
$ source bin/activate
$ git clone
$ cd djaodjin-deployutils
$ pip install -r testsite/requirements.txt

Create the credentials file with a ``DJAODJIN_SECRET_KEY``

$ make initdb

Run the web application

$ python runserver

Browse to http://localhost:8000

Bonus commands

Commands to upload/download resources

$ python download_resources
$ python upload_resources

Not all assets are stored under source control. Images, videos, etc. are
better kept outside the git repository. These two commands are used to
download the extra resources into the webapp htdocs/ directory from
the stage server and upload them from the webapp htdocs/ directory to
the stage server respectively.

Commands to setup on deployed servers

$ python pullapp

Fetch/merge from the remote git repository and downlad the extra resources
from the stage server.

Using configuration files from a S3 bucket

$ python upload_configs credentials site.conf
File Type Py Version Uploaded on Size
djaodjin-deployutils-0.4.7.tar.gz (md5) Source 2017-12-14 33KB