<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/tags/django</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 20 Jun 2013 05:20:08 GMT</pubDate>
<item>
<title>(Django) How to read \"_id\" field of an object in django templates - viroide</title>
<link>http://snipplr.com/view/71446/how-to-read-id-field-of-an-object-in-django-templates/</link>
<description><![CDATA[ <p>It's imposible to read de "_id" field en django templates ( {{element._id}} === error) So, to read it, you must do a templatetag. 

Now you hace the templatetag, you can use it like this: {{element|pk}}</p> ]]></description>
<pubDate>Fri, 07 Jun 2013 21:14:25 GMT</pubDate>
<guid>http://snipplr.com/view/71446/how-to-read-id-field-of-an-object-in-django-templates/</guid>
</item>
<item>
<title>(AppleScript) Restart Django development server using AppleScript - reynoldsdigital</title>
<link>http://snipplr.com/view/69782/restart-django-development-server-using-applescript/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 05 Feb 2013 03:44:27 GMT</pubDate>
<guid>http://snipplr.com/view/69782/restart-django-development-server-using-applescript/</guid>
</item>
<item>
<title>(Python) Use a django project with virtualenv from Scrapy - scrapy</title>
<link>http://snipplr.com/view/67013/use-a-django-project-with-virtualenv-from-scrapy/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 01 Sep 2012 07:15:35 GMT</pubDate>
<guid>http://snipplr.com/view/67013/use-a-django-project-with-virtualenv-from-scrapy/</guid>
</item>
<item>
<title>(AppleScript) Restart Django development server using AppleScript - cphoover</title>
<link>http://snipplr.com/view/66489/restart-django-development-server-using-applescript/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 03 Aug 2012 10:43:00 GMT</pubDate>
<guid>http://snipplr.com/view/66489/restart-django-development-server-using-applescript/</guid>
</item>
<item>
<title>(Python) SMTP sink server - cphoover</title>
<link>http://snipplr.com/view/66488/smtp-sink-server/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 03 Aug 2012 10:42:56 GMT</pubDate>
<guid>http://snipplr.com/view/66488/smtp-sink-server/</guid>
</item>
<item>
<title>(Python) Use email addresses for user name - cphoover</title>
<link>http://snipplr.com/view/66485/use-email-addresses-for-user-name/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 03 Aug 2012 10:42:45 GMT</pubDate>
<guid>http://snipplr.com/view/66485/use-email-addresses-for-user-name/</guid>
</item>
<item>
<title>(Python) Use email addresses for user name - munrobaggers</title>
<link>http://snipplr.com/view/65452/use-email-addresses-for-user-name/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 07 Jun 2012 02:53:41 GMT</pubDate>
<guid>http://snipplr.com/view/65452/use-email-addresses-for-user-name/</guid>
</item>
<item>
<title>(Python) SMTP sink server - munrobaggers</title>
<link>http://snipplr.com/view/65451/smtp-sink-server/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 07 Jun 2012 02:53:38 GMT</pubDate>
<guid>http://snipplr.com/view/65451/smtp-sink-server/</guid>
</item>
<item>
<title>(AppleScript) Restart Django development server using AppleScript - Tintenklecks</title>
<link>http://snipplr.com/view/63930/restart-django-development-server-using-applescript/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 15 Mar 2012 01:11:41 GMT</pubDate>
<guid>http://snipplr.com/view/63930/restart-django-development-server-using-applescript/</guid>
</item>
<item>
<title>(Python) Use email addresses for user name - inky76</title>
<link>http://snipplr.com/view/63763/use-email-addresses-for-user-name/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 07 Mar 2012 11:37:10 GMT</pubDate>
<guid>http://snipplr.com/view/63763/use-email-addresses-for-user-name/</guid>
</item>
<item>
<title>(Python) SMTP sink server - inky76</title>
<link>http://snipplr.com/view/63761/smtp-sink-server/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 07 Mar 2012 11:35:53 GMT</pubDate>
<guid>http://snipplr.com/view/63761/smtp-sink-server/</guid>
</item>
<item>
<title>(AppleScript) Restart Django development server using AppleScript - inky76</title>
<link>http://snipplr.com/view/63759/restart-django-development-server-using-applescript/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 07 Mar 2012 11:35:37 GMT</pubDate>
<guid>http://snipplr.com/view/63759/restart-django-development-server-using-applescript/</guid>
</item>
<item>
<title>(Python) Django global login middleware - lukasvinclav</title>
<link>http://snipplr.com/view/63002/django-global-login-middleware/</link>
<description><![CDATA[ <p>Django's middleware for global app login. With this middleware you don't have to decorate views by login_required decorator.</p> ]]></description>
<pubDate>Thu, 02 Feb 2012 19:25:48 GMT</pubDate>
<guid>http://snipplr.com/view/63002/django-global-login-middleware/</guid>
</item>
<item>
<title>(Python) Use email addresses for user name - tilakapash</title>
<link>http://snipplr.com/view/62266/use-email-addresses-for-user-name/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 04 Jan 2012 00:57:22 GMT</pubDate>
<guid>http://snipplr.com/view/62266/use-email-addresses-for-user-name/</guid>
</item>
<item>
<title>(Python) SMTP sink server - tilakapash</title>
<link>http://snipplr.com/view/62264/smtp-sink-server/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 04 Jan 2012 00:57:19 GMT</pubDate>
<guid>http://snipplr.com/view/62264/smtp-sink-server/</guid>
</item>
<item>
<title>(AppleScript) Restart Django development server using AppleScript - tilakapash</title>
<link>http://snipplr.com/view/62262/restart-django-development-server-using-applescript/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 04 Jan 2012 00:57:16 GMT</pubDate>
<guid>http://snipplr.com/view/62262/restart-django-development-server-using-applescript/</guid>
</item>
<item>
<title>(Django) Django: 3 ways to serve templates in views.py - chrisaiv</title>
<link>http://snipplr.com/view/62232/django-3-ways-to-serve-templates-in-viewspy/</link>
<description><![CDATA[ <p>There are so many ways to serve templates within views.py that sometimes it's hard to get a handle on which is ideal for a project.  This snippet does not attempt to explain every possible way to serve a template, simply a few I've found helpful organized from low-level (more code) to high-level (less code)</p> ]]></description>
<pubDate>Tue, 03 Jan 2012 03:36:32 GMT</pubDate>
<guid>http://snipplr.com/view/62232/django-3-ways-to-serve-templates-in-viewspy/</guid>
</item>
<item>
<title>(Django) Clean up expired django.contrib.session\'s in a huge MySQL InnoDB table - magicrebirth</title>
<link>http://snipplr.com/view/62190/clean-up-expired-djangocontribsessions-in-a-huge-mysql-innodb-table/</link>
<description><![CDATA[ <p>While django provides the django_admin.py cleanup script, if sessions get out of control sometimes you have to go lower level to get everything cleaned up. If the problem gets out of hand and you hit the resource limits of the machine, it is very difficult to get anything done in the database.

Attached is SQL code which was used to cleanup 27GB of expired session data in 3h. Run it like this to make sure it runs to completion:

`nohup mysql --user=username --password=password --host=hostname database < delete_expired_sessions.sql`

nohup causes the script to run detached from a terminal, so if your session gets disconnected it will keep running.

p.s.
An alternative approach is to launch this command from the shell:

DELETE FROM django_session WHERE expire_date < NOW();

or 

DELETE FROM django_session WHERE expire_date < "2011-12-10 00:00:00";</p> ]]></description>
<pubDate>Fri, 30 Dec 2011 23:12:12 GMT</pubDate>
<guid>http://snipplr.com/view/62190/clean-up-expired-djangocontribsessions-in-a-huge-mysql-innodb-table/</guid>
</item>
<item>
<title>(Django) Django: Configuring settings.py to rely on relative paths rather than absolute - chrisaiv</title>
<link>http://snipplr.com/view/62113/django-configuring-settingspy-to-rely-on-relative-paths-rather-than-absolute/</link>
<description><![CDATA[ <p>Hate absolute Paths? Me too, I always end up forgetting to change things around when I go into production mode.  Thankfully, there's a nice, clean way to have Python do all the hard work.</p> ]]></description>
<pubDate>Sat, 24 Dec 2011 03:24:17 GMT</pubDate>
<guid>http://snipplr.com/view/62113/django-configuring-settingspy-to-rely-on-relative-paths-rather-than-absolute/</guid>
</item>
<item>
<title>(Django) Django: check whether an object already exists before adding - magicrebirth</title>
<link>http://snipplr.com/view/59359/django-check-whether-an-object-already-exists-before-adding/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 03 Oct 2011 21:49:28 GMT</pubDate>
<guid>http://snipplr.com/view/59359/django-check-whether-an-object-already-exists-before-adding/</guid>
</item>
</channel>
</rss>