djangosnippets.org: Latest snippets posted by zvikicohttps://djangosnippets.org/users/zvikico/2011-06-28T01:25:41.582816-05:00zvikicoEnable AWS ELB with SSL Termination
2011-06-28T01:25:41.582816-05:00zvikicohttps://djangosnippets.org/snippets/2472/<p>When using Amazon's ELB with SSL termination, Django needs to know that the requests are secure. You need to use the special indication given on the request (HTTP_X_FORWARDED_PROTO) to determine that. This middleware will do that for you. </p>
<p>The second part is forcing requests to HTTPS in case they are …</p>
Freely redistributableDecoupling models with cross-database relations
2011-02-08T01:11:16.144981-06:00zvikicohttps://djangosnippets.org/snippets/2353/<p>The snippet enables decoupling model classes, associated with a ForeignKey, for the purpose of separating them into two databases. Looking at the following example:
</p>
<pre><code>class Reporter(models.Model):
...
class Article(models.Model):
reporter = models.ForeignKey(Reporter)
</code></pre><p>We want to separate the <code>Reporter</code> and <code>Article</code> into two separate databases, but this won't work in Django …</p>
Freely redistributable