Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

116 lines (79 sloc) 3.323 kb
.. _deployment:
In short:
* Create a ```` alongside ```` for your
host-specific settings (like database connection, email, etc).
* Configure your WSGI or FastCGI server.
All projects come with the deployment files to properly run your Pinax project
in a production environment. These are located in the ``deploy/`` directory
of your project.
Using mod_wsgi
Here is a basic configuration for Apache (assuming you are using Python 2.7)::
WSGIDaemonProcess mysite python-path=/path/to/mysite-env/lib/python2.7/site-packages
WSGIProcessGroup mysite
WSGIScriptAlias / /path/to/project/
<Directory /path/to/project>
Order deny,allow
Allow from all
The above configuration will likely need to be modified before use. Most
specifically make sure the ``python-path`` option points to the right Python
version. We encourage you to read about `WSGIDaemonProcess`_ to learn more
about what you can configure.
.. _WSGIDaemonProcess:
Using gunicorn
Install gunicorn_ in your environment (best to add it to your requirements
file) and run ``gunicorn``::
(mysite-env)$ pip install gunicorn
(mysite-env)$ gunicorn --workers=2 --bind= wsgi:application
This assumes your current working directory is your project root (``wsgi``
must be importable from where you are). Running the example shown above as-is
will not be sufficient for a production website. You will need to daemonize
the gunicorn processes and supervise them. Please refer to
`gunicorn documentation`_ for more information.
.. _gunicorn:
.. _gunicorn documentation:
Using FastCGI
To use FastCGI (including SCGI or AJP) you must install `flup`_. This can be
done by using ``pip``::
pip install flup
Once installed, you can use Django's built-in ``runfcgi`` management command
to run a server. For example::
python method=threaded host= port=3033
You can learn much more about ``runfcgi`` from the Django documentation on
`FastCGI deployment`_.
.. _flup:
.. _FastCGI deployment:
Media files
During development media files are handled for you by staticfiles. Serving of
media is controlled by ``DEBUG`` (previous versions of Pinax used an additional
setting ``SERVE_MEDIA`` that controlled this behavior, but it is now unused).
Pinax, by default, sets ``STATIC_ROOT`` and ``MEDIA_ROOT`` to directories
within the same directory (``site_media``). This is very beneficial to running
a production Pinax site as you can configure your web server to serve files
from a single directory.
To collect all your static files into ``STATIC_ROOT`` for your web server to
serve run::
(mysite-env)$ python collectstatic
server {
location /site_media {
alias /path/to/site_media;
<VirtualHost *:80>
Alias /site_media/ /path/to/site_media/
Jump to Line
Something went wrong with that request. Please try again.