|
Stephane
Aspen serving Django
Links
IntroductionStephane is a tiny shim that makes it trivially easy to serve Django apps with Aspen. Installation$ mkdir ~/www.example.com $ cd ~/www.example.com $ django-admin.py startproject <foo> $ svn export http://aspen-commons.googlecode.com/svn/stephane/trunk/__ ~/www.example.com will be on Django's PYTHONPATH, so you can include any third-party modules right next to your project package. Here's what your filesystem will look like: ~/www.example.com/ <= website root; added to PYTHONPATH ~/www.example.com/__/ <= Stephane (an Aspen "magic directory") ~/www.example.com/<foo>/ <= your Django project ~/www.example.com/geopy/ <= any other modules you need ~/www.example.com/README.aspen <= automatically added by Aspen UsageNow install Aspen, and: $ cd ~/www.example.com
$ export DJANGO_SETTINGS_MODULE=<foo>.settings
$ aspen
launching child process
starting child server
aspen starting on ('0.0.0.0', 8080)Congratulations! Aspen is running in development mode, and will restart whenever your project files change. DetailsStephane is trivial: 19 lines in 3 files. It is an Aspen magic directory pre-configured for Django. It includes a module called grappelli that adds the Aspen website root to PYTHONPATH, and configures Django using the DJANGO_SETTINGS_MODULE environment variable. It then tells Aspen to use Django's WSGI handler to serve all requests for this website. If DJANGO_SETTINGS_MODULE is unset, then it defaults to the value of settings_module in the [django] section of __/etc/aspen.conf. Please see the Stephane source and the Aspen documentation for a detailed understanding of how Stephane works. Stephane Grappelli was Django Reinhardt's long-time sideman and violin player. |
Sign in to add a comment