Thursday, September 3, 2009

Apache DocumentRoot in Python and Django

Be very deliberate in your overall architecture when setting up new django projects. The directory dependencies resulting from an apache-nginx-python-django server configuration can make your path dependencies very complicated.

Generally put, being indiscriminate in your setup now will result in extreme challenges to resource deployment later on.

Here are some working methods that can greatly complicate your setup:
  • Hosting several modules on one URL
  • Having only one virtual host for many projects
  • Hosting several modules on one server account
  • Setting Python gateway modules off the root of your URL
  • Using Python server.py-type gateways in addition to ordinary http gateways
Here are some ways to simplify your paths:
  • Set up several virtual hosts
  • Host only one Django project per URL (or as few as you can manage)
  • Clearly structure your resources to discourage any overlap on your VPS or dedicated server
  • Consider the trade-offs between a complex rig of sites and resources and several simple unrelated server environments. There's really no need to attempt the most complex possible solution unless that's your bag.
The nice thing about Python and Django is that they can handle either direction. There's a way to work everything out however you prefer, and the choice is yours to make.

That said, remember also that it is nice when projects just work without a lot of complex troubleshooting or traffic control.

Here is an example of a moderately complex configuration with a mixed bag of pros and cons.

No comments: