Forge Home

django

Deploy a Django app from git into an Apache web server

11,414 downloads

11,414 latest version

4.9 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.1.0 (latest)
released Feb 13th 2015
This version is compatible with:

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'jgazeley-django', '0.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jgazeley-django
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jgazeley-django --version 0.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

jgazeley/django — version 0.1.0 Feb 13th 2015

django

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

Overview

This module deploys self-contained Django apps from a git repo and configures them to run in an Apache virtual host using mod_wsgi.

Module Description

This module makes some assumptions about the layout of your Django application.

/var/www/${repo-name}  This level stored in the git repo and defined in $path
├─ requirements.txt    Lists dependencies
├─ virtualenv          Listed in .gitignore, generated by virtualenv
├─ setup.py
└─ ${project-name}     A collection of applications. Same name as the `django` resource
   ├─ application1     One application per "feature"
   ├─ application2
   └─ ${project-name}
      ├─ wsgi.py       Called by apache mod_wsgi
      └─ urls.py       Maps URLs onto applications
  • $repo-name is the name of your git repo
  • $project-name is the name of your project, which may or may not be the same as $repo-name

Be aware that when you start using this module, it will remove all other Apache virtual hosts from your system unless they are also managed with puppetlabs/apache.

Usage

This module has only one class, which can be called with the following parameters.

  ::django { 'django_app_test':
    source => 'git@git.example.com/djangodemo.git',
    path   => '/var/www/djangodemo',
    url    => 'djangodemo.example.com',
  }

source

Required parameter. URL to the source of your Django app in git, for example git://git.example.com/myapp.git

url

Required parameter. URL that will be used to serve the app from the Apache vhost, for example myapp.example.com

path

Optional parameter. The location on the filesystem where you want to install your Django app. If not specified, takes the value of /var/www/${name}, where $name is the calling title of your Django app.

ensure

Optional parameter. Defaults to present. Currently has no effect anyway.

revision

Optional parameter. Allows you to pass in a specific tag or revision of code in your git repo.

identity

Optional parameter. Specify the path to an SSH public key if your git repo requires authentication to clone.

ssl

Optional parameter. Enable SSL in your Apache vhost. Defaults to false.

port

Optional parameter. Override Apache listen port. Defaults to 80 if $ssl = false and 443 if $ssl = true.

ssl_cert

Optional parameter. Specify the path to your SSL certificate. Defaults to whatever puppetlabs/apache chooses for your OS.

ssl_key

Optional parameter. Specify the path to your SSL private key. Defaults to whatever puppetlabs/apache chooses for your OS.

Limitations

Tested on CentOS 6 with Apache 2.2.15 and Python 2.6.6. Should work on lots of other systems.

Development

This module is quite basic and provides functionality to install Django apps from Git repos into Apache virtual hosts with or without SSL. It was written for CentOS but will probably work on most other distros. I wrote this module to meet the needs of my employer. Features that aren't useful to my employer probably won't get much effort from me, but feel free to send pull requests with new features.

Obvious areas for improvement are:

  • Testing and adding support on other distros
  • Supporting more options to pass to Apache
  • Support for other version control systems (e.g. svn)
  • Support for other web servers (e.g. nginx)