Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Tentative documentation for Python support
Browse files Browse the repository at this point in the history
Change-Id: I8d0b991d1cf158b51249b0cd1f580acb85b88d76
  • Loading branch information
Sridhar Ratnakumar authored and Patrick Bozeman committed Aug 12, 2011
1 parent 05cb277 commit 0970961
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions docs/python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Python Support

Python applications are supported through the WSGI protocol. Gunicorn is used as
the web server serving WSGI applications, including Django. Non-Django
applications must have a top-level ``wsgi.py`` exposing an ``application``
variable that points to a WSGI application.

## Installing dependencies using pip

Python package prerequisites of your application can be defined in a top-level
``requirements.txt`` file (see [format
documentation](http://www.pip-installer.org/en/latest/requirement-format.html)),
which file is used by pip to install dependencies.

### Limitations

* Package dependencies are never cached, and they will be downloaded (and
installed) every time your app is updated or restarted.

## Django support

A special framework called "Django" exists to also perform Django-specific
staging actions. At the moment, this runs `syncdb` non-interactively to
initialize the database.

### Limitations

* Django admin (if your app uses it) will be unusable as superusers are not
created due to running `syncdb` non-interactively.

* Migration workflow, such as that of [South](http://south.aeracode.org/) are
not supported.

## Sample applications

### A hello world WSGI application

Here's a sample WSGI application using the "bottle" web framework.

$ mkdir myapp && cd myapp
$ cat > wsgi.py
import os
import sys
import bottle

@bottle.route('/')
def index():
pyver = '.'.join(map(str, tuple(sys.version_info)[:3]))
return 'Hello World! (from <b>Python %s</b>)' % (pyver,)

application = bottle.default_app()

if __name__ == '__main__':
bottle.run(host='localhost', port=8000)

$ cat > requirements.txt
bottle
$

0 comments on commit 0970961

Please sign in to comment.