Setting up a Django Website in the Princeton CS Environment


This guide is not about how to use the Django framework.  Rather, it describes the Princeton CS environment and how to setup a Django site in "project space" at that has reasonable portability to or from other hosting services when/if the need should arise.

Note that this guide should be considered an outline.   If you have questions, please contact

Python and Virtual Environments

Last major update: 2019-11-01

NOTE (2019-06-20): If your project relies on Python packages that CS Staff has previously installed at the system level, please migrate your project to a virtual environment immediately. We no longer install packages at the system level and, at our next major update of the Linux distribution on cycles, ionic, courselab, and armlab, we will not carry forward such packages.

Phusion Passenger

The CS project web server has Phusion Passenger support which allows for support of Ruby, Node.js, and Python/WSGI web applications through the Apache webserver. The instructions below will walk you through creating simple applications under each of these frameworks.

Using FastCGI

FastCGI is an extension of the CGI way of doing things. FastCGI will exec your program one time instead of once-per-request. Your program must then handle the input. Using available libraries, it is simple to use FastCGI. Here are a few examples in various interpreted languages.

Subscribe to RSS - python