Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

adds deployment docs

  • Loading branch information...
commit 4375e9ee76e87700f7959c97030a01af48e0bf6b 1 parent 4aa0b39
@ipmb ipmb authored
36 deployment/bootstrap.txt
@@ -0,0 +1,36 @@
+.. _deployment-bootstrap:
+Project Bootstrapping
+.. index:: virtualenv, pip
+Filesystem Layout
+.. note:: This document is heavily biased towards Unix-style filesystems and may require additional effort to use in other operating systems.
+`Virtualenv <>`_ is a must for Python projects. It provides a method to isolate different Python environments. We typically host our production sites from ``/opt/projects/<site_name>`` and our development sites from ``~/projects/<site_name>``. Each individual project gets its own ``virtualenv`` that also serves as the directory for all the source files associated with the project. We use ``pip`` to populate the ``virtualenv`` with the necessary packages.
+The bootstrap process looks like this:
+.. sourcecode:: bash
+ cd /opt/projects
+ virtualenv
+ cd
+ pip install -E . -r path/to/requirements.txt
+ source bin/activate
+.. tip:: For convenience, you can symlink your Django project into the root of your ``virtualenv``. The name of the symlink does not matter since your project should already live in the Python path. By giving the symlink the same name across all your projects, you can leverage some `convenient bash functions to save time <>`_.
+.. index:: pip, requirements.txt
+One of the keys to successful deployment is to ensure that the software you develop on is as close as possible to the software you deploy on. `Pip <>`_ provides a simple repeatable method allowing you to consistently deploy Python projects across many machines. Every application that requires third-party libraries should include a `pip requirements file <>`_ called ``requirements.txt``. Projects should aggregate the application requirements files adding any additional requirements as needed.
+.. rubric:: What to include in your requirements files
+Our rule of thumb is to include any application that is not included in your operating system's package repository. The only packages we exclude from our requirements files are ``PIL``, database drivers and packages that are uninstallable via ``pip``. These requirements are documented in the :ref:`project's README <projects-layout>`.
12 deployment/index.txt
@@ -0,0 +1,12 @@
+.. _deployment-index:
+.. toctree::
+ :maxdepth: 2
+ :glob:
+ *
8 deployment.txt → deployment/servers.txt
@@ -1,10 +1,10 @@
-.. _deployment-index:
+.. _deployment-servers:
.. index:: Apache, mod_wsgi, Nginx, PostgreSQL, Linux
-Deployment and Servers
.. note:: Deployment arcitectures vary widely depending on the needs and traffic of the site. The setup described below works best for us in most instances.
@@ -15,7 +15,7 @@ Nginx
`Nginx <>`__ makes for a great frontend server due to its speed, stability and low resource footprint. The typical Nginx configuration for a site looks like this:
-.. literalinclude:: examples/nginx.conf
+.. literalinclude:: /examples/nginx.conf
:language: nginx
.. rubric:: What Does it Do?
3  index.txt
@@ -23,4 +23,5 @@ Table of Contents
- projects/index
+ projects/index
+ deployment/index
13 projects/conventions/layout.txt
@@ -1,4 +1,4 @@
-.. _project-layout:
+.. _projects-layout:
Suggested Project layout
@@ -6,18 +6,9 @@ Suggested Project layout
.. sourcecode:: python
- local_apps/
- custom apps written for this project (Preferably Reusable; Probably on your PYTHONPATH)
- external_apps/
- External reusable apps you are using on this project
- Note: These apps can also live anywhere on your PYTHONPATH
- projects/
- dev_example/
- production_example/
- django96_example/
-, settings, urls, etc
This will hold the documentation for your project
Please sign in to comment.
Something went wrong with that request. Please try again.