Skip to content

Instantly share code, notes, and snippets.

@amcgregor
Created April 19, 2011 00:58
Show Gist options
  • Save amcgregor/926617 to your computer and use it in GitHub Desktop.
Save amcgregor/926617 to your computer and use it in GitHub Desktop.
An example filesystem structure that loosely follows the File Hierarchy Standard.

FHS-Based Python Web Application Deployment

The following is based off of one client application deployment scenario, with all of the files described herein managed in a Git repository.

This is NOT a proposed standard; if this is used at all, it’ll be used at the application server level and will be transparent to the underlying (embedded/mounted/mapped/attached/installed) application.

  1. /home/<user>/apps/<application>/ — Git Root
    1. .gitignore — Ignore almost everything.
    2. README.textile — Fancy GitHub notice.
    3. restart — Progressive upgrade / roll-out script. This and the start/stop scripts, below, are venv aware and do not require the venv to be active.
    4. start — Production startup.
    5. stop — Production shutdown.
    6. etc/ — Configuration.
      1. development.ini — Development, using Paste’s HTTP server.
      2. nginx.conf — Production nginx configuration, utilized by Nginx automatically.
      3. production.ini — Base production configuration, utilized by the sharding configs.
      4. shard-1.ini — First runner, there are usually n-cores minus one shards.
    7. src/ — Python package, installed via ./setup.py develop.
      1. setup.py
    8. usr/
      1. share/ — The web root, with files symlinked from elsewhere. (Git supports this.)
      2. src/ — Git externals for dependencies.
    9. var/ — Non-essential data, e.g. for Beaker sessions and cache.
      1. cache/
      2. locks/
      3. sessions/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment