<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Threepress Consulting blog &#187; django</title>
	<atom:link href="http://blog.threepress.org/tag/django/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.threepress.org</link>
	<description>Threepress creates software for publishers, educators and authors.</description>
	<lastBuildDate>Fri, 03 Sep 2010 23:28:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>On IBM Developerworks: Doing More with the Django Admin</title>
		<link>http://blog.threepress.org/2009/06/03/on-ibm-developerworks-doing-more-with-the-django-admin/</link>
		<comments>http://blog.threepress.org/2009/06/03/on-ibm-developerworks-doing-more-with-the-django-admin/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 15:01:42 +0000</pubDate>
		<dc:creator>Liza Daly</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[developerworks]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.threepress.org/?p=507</guid>
		<description><![CDATA[The second of two articles I wrote for IBM Developerworks: Doing More with the Django Admin (the first was Better Django Models).

The &#8220;Admin&#8221; is the administrative console that&#8217;s built into the Django application.  It provides an easy way to administer content on any Django site.  For developers who are tired of writing the [...]]]></description>
			<content:encoded><![CDATA[<p>The second of two articles I wrote for IBM Developerworks: <a href="http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html">Doing More with the Django Admin</a> (the first was <a href="http://blog.threepress.org/2009/06/02/on-ibm-developerworks-better-django-models/">Better Django Models</a>).</p>
<p><a href="http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html"><img src="http://blog.threepress.org/wp-content/uploads/2009/06/picture-26-289x300.png" alt="picture-26" title="picture-26" width="289" height="300" class="aligncenter size-medium wp-image-508" /></a></p>
<p>The &#8220;Admin&#8221; is the administrative console that&#8217;s built into the Django application.  It provides an easy way to administer content on any Django site.  For developers who are tired of writing the same admin functionality again and again (&#8220;Add/Edit/Delete page&#8221;) it&#8217;s a huge win.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.threepress.org/2009/06/03/on-ibm-developerworks-doing-more-with-the-django-admin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On IBM Developerworks: Better Django Models</title>
		<link>http://blog.threepress.org/2009/06/02/on-ibm-developerworks-better-django-models/</link>
		<comments>http://blog.threepress.org/2009/06/02/on-ibm-developerworks-better-django-models/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 14:48:28 +0000</pubDate>
		<dc:creator>Liza Daly</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[bookworm]]></category>
		<category><![CDATA[developerworks]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.threepress.org/?p=502</guid>
		<description><![CDATA[The first of two articles I wrote about the Python web framework Django has been published by IBM Developerworks: Better Django Models.

Neither one is publishing-specific, but Django (like Rails and Drupal) is a great way to deploy a web application quickly and easily. (Bookworm runs on Django, as do many of my smaller projects.)
]]></description>
			<content:encoded><![CDATA[<p>The first of two articles I wrote about the Python web framework Django has been published by IBM Developerworks: <a href="http://www.ibm.com/developerworks/opensource/library/os-django-models/index.html">Better Django Models</a>.</p>
<p><a href="http://www.ibm.com/developerworks/opensource/library/os-django-models/index.html"><img src="http://blog.threepress.org/wp-content/uploads/2009/06/picture-25-300x290.png" alt="picture-25" title="picture-25" width="300" height="290" class="aligncenter size-medium wp-image-503" /></a></p>
<p>Neither one is publishing-specific, but Django (like Rails and Drupal) is a great way to deploy a web application quickly and easily. (<a href="http://bookworm.oreilly.com/">Bookworm</a> runs on Django, as do many of my smaller projects.)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.threepress.org/2009/06/02/on-ibm-developerworks-better-django-models/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Django/MySQL database backup script</title>
		<link>http://blog.threepress.org/2008/07/17/djangomysql-database-backup-script/</link>
		<comments>http://blog.threepress.org/2008/07/17/djangomysql-database-backup-script/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 23:38:25 +0000</pubDate>
		<dc:creator>Liza Daly</dc:creator>
				<category><![CDATA[tools]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.threepress.org/?p=20</guid>
		<description><![CDATA[I&#8217;m sure everyone has one of these lying around, but here&#8217;s mine in case you are as lazy a programmer as I usually am.  The only thing Django-specific about it is that it reads your database configuration directly out of your settings file.
If you run this via cron it will automatically create its backup directory [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure everyone has one of these lying around, but here&#8217;s mine in case you are as lazy a programmer as I usually am.  The only thing Django-specific about it is that it reads your database configuration directly out of your settings file.</p>
<p>If you run this via cron it will automatically create its backup directory and a zipped SQL dump with the name of the current day of the week.  If one already exists, it simply overwrites it.  This means you&#8217;ll have a week&#8217;s worth of daily rolling backups.  If you need more granularity, add a timestamp to the datestamp.  If you need more persistent backups, switch to a full date scheme.</p>
<p>The latest version of this can always been found <a href="http://code.google.com/p/threepress/source/browse/trunk/bookworm/database-backup.py">here</a>.<br />
<span id="more-20"></span></p>
<pre class="brush: plain;">
#!/usr/bin/env python

import sys
import os.path
import os
import logging
from datetime import datetime
from settings import DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD

logging.basicConfig(level=logging.WARN)

BACKUP_DIR = &quot;%s/backups&quot; % os.path.dirname(__file__)
MYSQL_CMD = 'mysqldump'
ZIP_CMD = 'zip'

def _setup():
   if not os.path.exists(BACKUP_DIR):
       logging.debug(&quot;Created backup directory %s&quot; % BACKUP_DIR)
       os.mkdir(BACKUP_DIR)
   else:
       logging.debug(&quot;Using backup directory %s&quot; % BACKUP_DIR)

def _backup_name():
   now = datetime.now()
   day_name = now.strftime(&quot;%A&quot;)
   file_name = &quot;%s.sql&quot; % day_name.lower()
   logging.debug(&quot;Setting backup name for day name %s as %s&quot; % (day_name, file_name))
   return file_name

def _run_backup(file_name):
   cmd = &quot;%(mysqldump)s -u %(user)s --password=%(password)s %(database)s &gt; %(log_dir)s/%(file)s&quot; % {
       'mysqldump' : MYSQL_CMD,
       'user' : DATABASE_USER,
       'password' : DATABASE_PASSWORD,
       'database' : DATABASE_NAME,
       'log_dir' : BACKUP_DIR,
       'file': file_name}
   logging.debug(&quot;Backing up with command %s &quot; % cmd)
   return os.system(cmd)

def _zip_backup(file_name):
   backup = &quot;%s/%s&quot; % (BACKUP_DIR, file_name)
   zipfile_name = &quot;%s.zip&quot; % (backup)

   if os.path.exists(zipfile_name):
       logging.debug(&quot;Removing previous zip archive %s&quot; % zipfile_name)
       os.remove(zipfile_name)
   zip_cmds = {'zip' : ZIP_CMD, 'zipfile' : zipfile_name, 'file' : backup }

   # Create the backup
   logging.debug(&quot;Making backup as %s &quot; % zipfile_name)
   os.system(&quot;%(zip)s -q -9 %(zipfile)s %(file)s&quot; % zip_cmds)

   # Test our archive
   logging.debug(&quot;Testing zip archive&quot;)
   if not os.system(&quot;%(zip)s -T -D -q %(zipfile)s&quot; % zip_cmds):
       # If there was no problem, then delete the unzipped version
       os.remove(backup)
       return True
   else:
       return False

def main(*args):
   _setup()
   file_name = _backup_name()
   _run_backup(file_name)
   return(_zip_backup(file_name))

if __name__ == '__main__':
   sys.exit(main(*sys.argv))    
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.threepress.org/2008/07/17/djangomysql-database-backup-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
