<p>I know you can do redirection based on the domain or path to rewrite the URI to point at a site-specific location and I've also seen some brutish <code>if</code> and <code>elif</code> statements for every site as shown in the following code, which I would like to avoid.</p>
<pre class="lang-py prettyprint-override"><code>if site == 'site1':
    ...
elif site == 'site2:
    ...
</code></pre>
<p>What are some good and clever ways of running multiple sites from a single, common Python web framework (i.e., Pylons, TurboGears, etc)?</p>

Django has this built in.  See
the sites framework
.
As a general technique, include a 'host' column in your database schema attached to the data you want to be host-specific, then include the
```
Host
```
HTTP header in the query when you are retrieving data.