django-in-a-box / docs / wiki / layout /

Full commit

Site Directories

A standard Django-in-a-Box site directory looks like this:

|-- bin/
|-- cache/
|-- db/
|-- include/
|-- lib/
|-- log/
|-- pid/
|-- project_dir/
|-- sock/
`-- uploads/

The site directory will contain everything needed for a running instance of your site. The immediate subdirectories in the site directory, with the exception of the project directory (project_dir/), are specific to that one deployment of the site; things like UNIX socket files, filesystem-based caches, SQLite database and virtualenv machinery go in these immediate subdirectories. For more information on the role of the site as it relates the the project, consult the concepts documentation.

bin/, include/ and lib/
These directories contain the virtualenv machinery; virtualenv allows a site to contain sandboxed installations of Python packages.
Used as a filesystem-based cache for whatever components need it; it can also be used to save temporary files. At the moment it is used by lighttpd’s mod_compress to cache gzipped media files.
Can be used in a development environment to store SQLite databases. These are usually stored as db/development.sqlite. SQLite is sometimes used for non-production deployments because it is a lot more easy to set up than MySQL or PostgreSQL. It is, however, unsuitable for deployments with high concurrency or load.
Used to store log files from Python, Supervisor, lighttpd and any other site-specific program which may generate logging data.
Houses the PID files for running services; by default, this is just Supervisor (pid/ You can forcibly kill a given service by running kill -9 $(cat pid/
Contains UNIX sockets; these are used instead of the typical host:port model for interprocess communication via TCP. In the scaffolding, the FastCGI daemon config uses a UNIX socket so that Supervisor can spread the load amongst several worker processes.
Stores temporary and permanent file uploads from the web server. It can be used by the Django site to save user uploads, but it is also used by lighttpd to store uploads in chunks when a large amount of POST data is being sent from a client. Usually, this chunking occurs for uploads of 1MB or greater.