To use run: startproject --template --extension py,md,conf,ini,html YOURPROJECTNAME
Switch branches/tags
Nothing to show
Pull request Compare This branch is 9 commits ahead, 4 commits behind amccloud:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

{% comment %}

Using this Project Template startproject --template --extension py,md,conf,ini,html YOURPROJECTNAME

{% endcomment %}

{{ project_name|title }} Django Project


  • python >= 3.4


Clone the code

Obtain the url to your git repository.

git clone <URL_TO_GIT_RESPOSITORY> {{ project_name }}

Setup Virtual Environment

cd {{ project_name }}
pyvenv venv

Install requirements

source bin/activate
pip install -r requirements.txt

Configure local project settings

cp {{ project_name }}/ {{ project_name }}/
vim {{ project_name }}/

Migrate Database

python migrate

Configure Logging

sudo mkdir -p /var/log/django
sudo chmod +w /var/log/django

# or simply disable logfile logging locally in


python runserver

Open browser to

Deploying to Production (Redhat 5) Example

Note: This example is out of date, but left here as an example of using fabric

Much of the installation setup has come from a 5 part series:

# as root on the server

useradd -s /bin/bash -d /home/django django
echo "YOURUSERPASSWORD" | passwd --stdin django
echo "django ALL=(ALL) ALL" >> /etc/sudoers

# enable EPEL (for nginx and others)
rpm -ivh

sudo yum -y install python python-devel python-setuptools git libpcre3 libpcre3-dev nginx gcc
chkconfig nginx on
sudo easy_install pip
pip install virtualenv uwsgi
mkdir -p /etc/uwsgi

/sbin/iptables -A INPUT -m state --state NEW -p tcp --dport 8000 -j ACCEPT
mkdir /var/log/django
chown -R django:django /var/log/django
chmod -R 770 /var/log/django

# disable selinux
vim /etc/sysconfig/selinux
# change to disabled - then reboot the server (sigh)

shutdown -r now

Now we need to do some preparation work on the production server as our django user

su - django
cd /home/django
mkdir -p git/repositories
cd git/repositories
mkdir {{ project_name }}.git
cd {{ project_name }}.git
git init --bare

At this point, you probably want to add your ssh key to the authorized_keys file of the django user to avoid constantly typing the ssh password of the django user. Locally:

# from your machine
ssh-copy-id django@prodserver

Add the production git repository as a remote from our local machine

workon {{ project_name }}
git remote add django1{{ project_name }}.git
git push django1 master

Then we use Fabric to do deployment

workon {{ project_name }}

# edit in your production host in the hosts attribute within the production() function
# then...

fab production setup

# now go to your server, and modify /home/django/sites/{{ project_name }}/ with production settings

fab production deploy
fab production rollback
fab production rollback # continually switches between "current" and "previous" releases