<?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>geek scrap &#187; django</title>
	<atom:link href="http://geekscrap.com/feed/?tag=django" rel="self" type="application/rss+xml" />
	<link>http://geekscrap.com</link>
	<description>there is at least one way to do it</description>
	<lastBuildDate>Tue, 12 Apr 2011 10:14:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Integrate WordPress and Django</title>
		<link>http://geekscrap.com/2010/02/integrate-wordpress-and-django/</link>
		<comments>http://geekscrap.com/2010/02/integrate-wordpress-and-django/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 08:00:21 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wsgi]]></category>
		<category><![CDATA[xml-rpc]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=675</guid>
		<description><![CDATA[Last year WordPress got an award as best Open Source CMS software and the reason is clear: it&#8217;s easy to setup, low on resources, very customizable and full of useful extensions. So unless you have very specific deployment requirements and if your blog is not part of your core technology, you may get the best [...]]]></description>
			<content:encoded><![CDATA[<p>Last year WordPress got an <a href="http://www.packtpub.com/award">award</a> as best Open Source CMS software and the reason is clear: it&#8217;s easy to setup, low on resources, very customizable and full of useful extensions. So unless you have very specific deployment requirements and if your blog is not part of your core technology, you may get the best of both worlds by using WordPress for blogging and use a web framework for everything else. Not reinventing the wheel is very important in post-agile world, after all.</p>
<p>Being a Django monkey, I&#8217;d like to share some tips on how to make WordPress and Django live together:<br />
<span id="more-675"></span></p>
<h2>URL mapping</h2>
<p>To make WordPress and Django co-exist, they should map to different parts of the url space: you can simply configure them to respond on different virtual hosts, or just map WordPress to a specific path. For instance, if your webserver is Apache and you&#8217;re serving Django through mod_wsgi, you can use a config snippet like this:</p>
<pre>&lt;VirtualHost *:80&gt;
ServerName somehost.com
ServerAdmin hostmaster@somehost.com
ErrorLog /path/to/somehost.com/log/error.log
CustomLog /path/to/somehost.com/log/access.log combined
DirectoryIndex index.html
DocumentRoot /var/empty
WSGIScriptAlias / /path/to/somehost.com/parts/wsgi/wsgi
WSGIDaemonProcess somehost.com user=www group=www threads=25
WSGIProcessGroup somehost.com
Alias /blog/ /path/to/somehost.com/wordpress/
Alias /media/ /path/to/somehost.com/project/media/

&lt;Directory /path/to/somehost.com/wordpress/&gt;
Order allow,deny
Allow from all
&lt;/Directory&gt;

&lt;Directory /path/to/somehost.com/media/&gt;
Order allow,deny
Allow from all
&lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre>
<h2>Accessing data</h2>
<p>To share data between your WordPress blog and your Django instance, you have <span style="text-decoration: line-through;">two</span> three main options:</p>
<ol>
<li>Save your WordPress tables and your Django models in the same database and configure your Django models accordingly.<br />
<strong>Pros</strong>: this approach is very straightforward and you don&#8217;t need to learn WordPress API. You can use Django admin interface to edit your WordPress database.<br />
<strong>Cons</strong>: sharing a database between two applications can have an impact on maintenance issues. For example, to rehash your Django application, you can&#8217;t just drop database, re-create it and populate with <em>syncdb</em>. WordPress database schema can change in new releases and make your ORM mapping obsolete.</li>
<li>Use Python&#8217;s xmlrpclib in Django to access WordPress XML-RPC interface.<br />
<strong>Pros</strong>: API changes won&#8217;t possibly break compatibility with previous releases. XML-RPC adds more logic, which means more consistency checks and more behind-the-curtain processing.<br />
<strong>Cons</strong>: XML-RPC calls are not as performant as direct access to MySQL.</li>
<li><strong>UPDATE</strong>: <a rel="nofollow" href="http://dougma.com/">Doug</a> pointed me to another method: adding a <a rel="nofollow" href="http://code.djangoproject.com/ticket/2440">PHP template loader</a> to Django. An useful <a rel="nofollow" href="http://showmedo.com/videotutorials/video?name=pythonNapleonePyConTech2&amp;fromSeriesID=54">video tutorial</a> is also available.</li>
</ol>
<p>To setup method 1, you can use <a rel="nofollow" href="http://code.google.com/p/django-wordpress-admin/source/browse/trunk/wordpress/models.py">models.py</a> from <a rel="nofollow" href="http://code.google.com/p/django-wordpress-admin/">django-wordpress-admin</a> project, which was built around <a rel="nofollow" href="http://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb">inspectdb</a> output with some custom manager enhancements. On GitHub there&#8217;s another project named <a href="http://github.com/sunlightlabs/django-wordpress">django-wordpress</a>, with the same approach and a step-by-step tutorial is published at <a href="http://uswaretech.com/blog/2010/01/wordpress-and-django-best-buddies/">uswaretech.com</a>.</p>
<p>If you found Django-Wordpress integration tips useful, please drop a note in the comment box below to say how you used it, or just stay in touch with <a rel="nofollow" href="http://twitter.com/geekscrap">Twitter</a> or <a href="http://geekscrap.com/feed/">RSS Feed</a> for more Django stories.</p>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/02/integrate-wordpress-and-django/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Integrate Tornado in Django</title>
		<link>http://geekscrap.com/2010/02/integrate-tornado-in-django/</link>
		<comments>http://geekscrap.com/2010/02/integrate-tornado-in-django/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:32:00 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[How-tos]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[supervisord]]></category>
		<category><![CDATA[tornado]]></category>
		<category><![CDATA[wsgi]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=588</guid>
		<description><![CDATA[Tornado is a nice python WSGI-compliant web server developed by guys at FriendFeed. It&#8217;s primarily thought as application server for python web frameworks and according to FriendFeed benchmarks, it&#8217;s blazing fast thanks to its non-blocking connections. UPDATE: For more performance info, James Abley pointed me to a very complete benchmark of available Python asynchronous webservers. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tornadoweb.org/">Tornado</a> is a nice python WSGI-compliant web server developed by guys at FriendFeed. It&#8217;s primarily thought as application server for python web frameworks and according to FriendFeed benchmarks, it&#8217;s blazing fast thanks to its non-blocking connections.</p>
<p><strong>UPDATE</strong>: For more performance info, James Abley pointed me to a <a rel="nofollow" href="http://nichol.as/asynchronous-servers-in-python">very complete benchmark</a> of available Python asynchronous webservers. It looks like Tornado is a real monster of concurrency.</p>
<p>There are already some how-to&#8217;s on the web on plugging Django web framework into Tornado webserver. A quick recap:</p>
<ol>
<li>A <a rel="nofollow" href="http://www.jeremybowers.com/blog/4/tornado-web-framework-production-django-and-nginx/">tutorial</a> on Tornado, Django and nginx by Jeremy Bowers.</li>
<li>How to <a rel="nofollow" href="http://lincolnloop.com/blog/2009/sep/15/using-django-inside-tornado-web-server/">import django framework</a> inside a Tornado project by Lincoln Loop.</li>
<li>A <a rel="nofollow" href="http://www.djangosnippets.org/snippets/1748/">snippet</a> by lawgon.</li>
</ol>
<p>My approach is slightly different as I wanted to run Tornado using Django management command-line interface.</p>
<p><span id="more-588"></span>The 3 easy steps are:</p>
<ol>
<li>Add Tornado module to your django setup. If you use buildout, add Tornado git checkout to buildout.cfg using <em>minitage.recipe.fetch</em> recipe, like this:
<pre lang="ini">[buildout]
...
parts =
...
    tornado
    django
...

[tornado]
recipe = minitage.recipe.fetch
urls = git://github.com/facebook/tornado.git | git | | ${buildout:parts-directory}/tornado

[django]
recipe = minitage.recipe.scripts
initialization =
    import os
    os.environ['DJANGO_SETTINGS_MODULE']='project.settings.development'
scripts =
    django
eggs =
    Django
    ...
entry-points=
    django=django.core.management:execute_from_command_line
extra-paths =
    ${buildout:directory}
    ${tornado:location}
...</pre>
</li>
<li>Next, create a command-line extension hierarchy in your project&#8217;s main app:
<pre>$ mkdir project/myapp/management
$ touch project/myapp/management/__init__.py
$ mkdir project/myapp/management/commands
$ touch project/myapp/management/commands/__init__.py</pre>
</li>
<li>Last, add a runtornado.py script in project/myapp/management/commands/ folder with the following content:
<pre lang="python">from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
import os
import sys

class Command(BaseCommand):
    option_list = BaseCommand.option_list + ()
    help = "Starts a Tornado Web."
    args = '[optional port number, or ipaddr:port]'

    def handle(self, addrport='', *args, **options):
        import django
        from django.core.handlers.wsgi import WSGIHandler
        from tornado import httpserver, wsgi, ioloop

	sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
	sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)

        if args:
            raise CommandError('Usage is runserver %s' % self.args)
        if not addrport:
            addr = ''
            port = '8000'
        else:
            try:
                addr, port = addrport.split(':')
            except ValueError:
                addr, port = '', addrport
        if not addr:
            addr = '127.0.0.1'

        if not port.isdigit():
            raise CommandError("%r is not a valid port number." % port)

        quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C'

        def inner_run():
            from django.conf import settings
            print "Validating models..."
            self.validate(display_num_errors=True)
            print "\nDjango version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE)
            print "Server is running at http://%s:%s/" % (addr, port)
            print "Quit the server with %s." % quit_command
            application = WSGIHandler()
            container = wsgi.WSGIContainer(application)
            http_server = httpserver.HTTPServer(container)
            http_server.listen(int(port), address=addr)
            ioloop.IOLoop.instance().start()

        inner_run()</pre>
</li>
</ol>
<p>To run your tornado webserver, you just need to call your usual management program like manage.py with runtornado command, with the same syntax as runserver. In my case, I just run production server using <a rel="nofollow" href="http://supervisord.org/">supervisord</a>, with a command like this:</p>
<pre>$ ./bin/django runtornado --settings=project.settings.production 8000</pre>
<p>If you found this quick how-to useful, remember to follow me on <a rel="nofollow" href="http://twitter.com/geekscrap">Twitter</a> or subscribe to my feed for more django tips.</p>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/02/integrate-tornado-in-django/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>8 web design add-ons for Django</title>
		<link>http://geekscrap.com/2010/02/8-web-design-add-ons-for-django/</link>
		<comments>http://geekscrap.com/2010/02/8-web-design-add-ons-for-django/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 08:30:54 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[templatetag]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=446</guid>
		<description><![CDATA[In the last year, I&#8217;ve defined a quite stable fundation for my django projects. In this post I&#8217;m enumerating template design components that saved my day by reducing development time while keeping code readable, concise and standard-compliant. 1. Blueprint CSS framework While not a django-specific add-on, Blueprint CSS framework is a perfect companion for django [...]]]></description>
			<content:encoded><![CDATA[<p>In the last year, I&#8217;ve defined a quite stable fundation for my django projects. In this post I&#8217;m enumerating template design components that saved my day by reducing development time while keeping code readable, concise and standard-compliant.</p>
<h3>1. Blueprint CSS framework</h3>
<p>While not a django-specific add-on, <a rel="nofollow" href="http://www.blueprintcss.org/">Blueprint CSS framework</a> is a perfect companion for django template designers: it features<em> cross-browser style reset</em>, <em>a 24-column grid layout</em>, <em>a nice looking typography</em> and a <em>print-friendly style</em>.</p>
<h3>2. django-uni-form</h3>
<p><a rel="nofollow" href="http://github.com/pydanny/django-uni-form/tree/master">django-uni-form</a> implements <a href="http://www.sprawsm.com/uni-form/">UniForm CSS framework</a> in Django: you can render your forms as stylish xhtml-compliant divs using a simple template tag filter and add form layout information to your Form classes.</p>
<p><span id="more-446"></span></p>
<h3>3. django-compress</h3>
<p>Optimization of CSS and Javascript distribution can greatly improve web client rendering times: <a rel="nofollow" href="http://code.google.com/p/django-compress/">django-compress</a> outputs <em>concatenated and minified</em> files and handles <em>smart client-side caching</em>.</p>
<h3>4. django-userskins</h3>
<p>Using <a rel="nofollow" href="http://github.com/lethain/django-userskins">django-userskins</a> you can enable user-selected themes in your application.</p>
<h3>5. django-tabs</h3>
<p>For your navigation bar, you can use <a rel="nofollow" href="http://code.google.com/p/django-tabs/">django-tabs</a> to highlight active tab (possibly with multiple navigation layers), by combining Django template extension mechanism and a special template tag.</p>
<h3>6. django-reversetag</h3>
<p>Default url tag is quite primitive, but using <em>reverse</em> tag introduce by <a rel="nofollow" href="http://github.com/ulope/django-reversetag">django-reversetag</a>, you can resolve urls from variables and string literals, which is very useful if your view or named view is computed at run-time.</p>
<h3>7. macros template tags</h3>
<p>Django <a rel="nofollow" href="http://www.djangosnippets.org/snippets/363/">macros</a> template tags help you apply DRY criterias in your templates, while maintaining separation between presentation and logic. Download macros.py and save it into your app&#8217;s templatetags folder.</p>
<h3>8. smart_if template tags</h3>
<p><a rel="nofollow" href="http://www.djangosnippets.org/snippets/1350/">smart_if</a> template tag add-on replaces default if/else/endif tags with a custom version that allows basic yet useful value comparisons.  Download smart_if.py and save it into your app&#8217;s templatetags folder.</p>
<p><strong>Tip</strong>: original smart_if doesn&#8217;t support <em>elif</em> syntax. You can find amended version <a rel="nofollow" href="http://www.djangosnippets.org/snippets/1572/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/02/8-web-design-add-ons-for-django/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>.gitignore for Django buildout</title>
		<link>http://geekscrap.com/2010/01/gitignore-for-django-buildout/</link>
		<comments>http://geekscrap.com/2010/01/gitignore-for-django-buildout/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 07:30:37 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[How-tos]]></category>
		<category><![CDATA[.gitignore]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[minitage]]></category>
		<category><![CDATA[pyc]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=342</guid>
		<description><![CDATA[If you&#8217;re keeping your django buildout installation under git, you may find the following .gitignore list useful to prevent your commits from cluttering with ugly temporary files (of course it also applies to other revision control system ignore files). You may need to adapt folder names to your buildout.cfg setup. *~ *.orig *.pyc *.rej .installed.cfg [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re keeping your django buildout installation under git, you may find the following <em>.gitignore</em> list useful to prevent your commits from cluttering with ugly temporary files (of course it also applies to other revision control system ignore files). You may need to adapt folder names to your buildout.cfg setup.</p>
<p><span id="more-342"></span></p>
<pre>*~
*.orig
*.pyc
*.rej
.installed.cfg
__minitage__*
bin/*
develop-eggs
downloads
eggs
log
parts
project/media/uploads
tmp</pre>
<p>As usual, feel free to post your additions as comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/01/gitignore-for-django-buildout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django dynamic template paths</title>
		<link>http://geekscrap.com/2010/01/django-dynamic-template-paths/</link>
		<comments>http://geekscrap.com/2010/01/django-dynamic-template-paths/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 08:30:38 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[How-tos]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[pyclbr]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[readmodule_ex]]></category>
		<category><![CDATA[reversion]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=214</guid>
		<description><![CDATA[Several add-on applications for Django bring in their own templates and expect user to hardcopy those files into project&#8217;s template directory. The problem raises when add-on egg is updated and its hardcopied templates are not. Another approach could be to add add-on template directory path to TEMPLATE_DIRS variable in project&#8217;s settings.py. However, once add-on application [...]]]></description>
			<content:encoded><![CDATA[<p>Several add-on applications for Django bring in their own templates and expect user to hardcopy those files into project&#8217;s template directory. The problem raises when add-on egg is updated and its hardcopied templates are not. Another approach could be to add add-on template directory path to TEMPLATE_DIRS variable in project&#8217;s settings.py. However, once add-on application is updated, hardcoded path may not be up-to-date.</p>
<p><strong>UPDATE</strong>: Vinicius Mendes commented on using <a rel="nofollow" href="http://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types">django.template.loaders.app_directories.Loader</a> to solve the problem (a similar module exists for eggs, which is named django.template.loaders.eggs.Loader). It&#8217;s definitely the easiest way if you don&#8217;t mind importing all of your applications templates. Instead, if you need to pick only selected directories or non-standard directory names, keep on reading.</p>
<p><span id="more-214"></span></p>
<p>The solution is to add a dynamic path that is resolved at runtime using add-on egg&#8217;s path. Here&#8217;s an example of how I got <a rel="nofollow" href="http://code.google.com/p/django-reversion/">django-reversion</a> templates added:</p>
<pre lang="python">import os
from  pyclbr import readmodule_ex

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname(__file__), "../templates"),
    os.path.join(os.path.dirname(readmodule_ex('reversion')['__path__'][0]), "templates"),
)</pre>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/01/django-dynamic-template-paths/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Django and mysql names</title>
		<link>http://geekscrap.com/2010/01/django-and-mysql-names/</link>
		<comments>http://geekscrap.com/2010/01/django-and-mysql-names/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 17:15:22 +0000</pubDate>
		<dc:creator>geekscrap</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[How-tos]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[dmigrations]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://geekscrap.com/?p=70</guid>
		<description><![CDATA[Using django 1.1.1 framework with dmigrations tool, I&#8217;ve discovered that they don&#8217;t honour mysql naming conventions correctly. In fact, mysql has a limit of 64 characters on table names, index names and column names, but django doesn&#8217;t take it into account when generating tables and indices from models. In vanilla django, using &#8220;manage.py sql&#8221; or [...]]]></description>
			<content:encoded><![CDATA[<p>Using <a rel="nofollow" href="http://www.djangoproject.com/">django</a> 1.1.1 framework with <a rel="nofollow" href="http://code.google.com/p/dmigrations/">dmigrations</a> tool, I&#8217;ve discovered that they don&#8217;t honour mysql naming conventions correctly. In fact, mysql has a limit of 64 characters on table names, index names and column names, but django doesn&#8217;t take it into account when generating tables and indices from models.</p>
<p><span id="more-70"></span>In vanilla django, using &#8220;manage.py sql&#8221; or &#8220;manage.py sqlindexes&#8221; you can generate respectively &#8220;CREATE TABLE&#8221; and &#8220;CREATE INDEX&#8221; sql statements to setup your database schema (if you use manage.py syncdb, generated sql is feeded into your database). Table names are defined in <em>db_table</em> variable in model&#8217;s meta class and default name is generated using the following statement in django.db.models.options:</p>
<pre lang="python">self.db_table = "%s_%s" % (self.app_label, self.module_name)</pre>
<p>Now, if your generated db_table is greater than 64 characters (quite easy if your application name is long), django doesn&#8217;t truncate it and when sql is feeded into mysql, table creation routine will fail. A similar trouble happens for index creation routine (typically used with <em>unique</em> constraints) and using dmigrations tool instead of plain syncdb doesn&#8217;t get any better.</p>
<p>At this point, there are two options for table naming:</p>
<ol>
<li>Renaming tables in models.py by hand (quite boring if your project is big).</li>
<li>Patching django to apply a truncation to db_table.</li>
</ol>
<p>For option 2, here&#8217;s the simple one-liner patch you need for django 1.1.1:</p>
<pre lang="patch">--- django/db/backends/mysql/base.py.orig
+++ django/db/backends/mysql/base.py
@@ -214,6 +214,9 @@
         second = '%s-12-31 23:59:59.99'
         return [first % value, second % value]

+    def max_name_length(self):
+        return 64
+
 class DatabaseWrapper(BaseDatabaseWrapper):

     operators = {</pre>
<p>In dmigrations, index names are defined as:</p>
<pre lang="python">index_name = '%s_%s_%s' % (app, model, column)</pre>
<p>You can fix the length problem in r29 with this simple patch:</p>
<pre lang="patch">--- dmigrations/mysql/migrations.py.orig
+++ dmigrations/mysql/migrations.py
@@ -141,7 +141,7 @@
     def __init__(self, app, model, column):
         model = model.lower()
         self.app, self.model, self.column = app, model, column
-        index_name = '%s_%s_%s' % (app, model, column)
+        index_name = '%s_refs_id_%s' % (column, abs(hash((app, model, column))))
         super(AddIndex, self).__init__(
             sql_up = [self.add_index_sql % (index_name, app, model, column)],
             sql_down = [self.drop_index_sql % (app, model, index_name)],</pre>
]]></content:encoded>
			<wfw:commentRss>http://geekscrap.com/2010/01/django-and-mysql-names/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->