Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django design patterns
This is announcement about our new work, Django design patterns, a ebook about, well, Django design patterns. (Well imagine that!). Here is the readme copied from there. [Edit] Syntax highlighting and indentation preservation were totally brroken. Fixed now. Django design patterns is a book about commonly occuring patterns in Django. Not patterns in Gof sense, but patterns in the sense, we work this way, and it works for us. For us it is a ~pattern of work~ sense. At this point this is just a lot of brain dump from us. The latest sources are always available from http://github.com/uswaretech/django-design-patterns/tree/master and latest html from http://djangodesignpatterns.uswaretech.net/ Please leave errata, feedback, critique as comments here. This is still very much a work in progress, released in the spirit of release early, release often. Click here to get it, or fork it on Github -
Aren't django signals a little like comefrom?
In computer programming, COMEFROM (or COME FROM) is an obscure control flowstructure used in some programming languages, primarily as a joke. I never liked using signals. Recently I was asked that, and has no answer, but a little thinking led me to this question. Aren't signals a little like COMEFROM. If yes, aren't they as bad as COMEFROM? If you do not know what a COMEFROM is, [wikipedia to the rescue](http://en.wikipedia.org/wiki/COMEFROM) Some hypothetical code using COMEFROM, again from wikipedia, from goto import comefrom, label comefrom .repeat name = raw_input('what is your name? ') if name: print "Hello",name label .repeat print "Goodbye!" And Some actual Django code using signals class Post(models.Model): name = models.CharField(...) ... num_comments = models.PositiveIntegerField(default = 0) class Comment(models.Model): ... post = models.ForeignKey(Post) def handle_num_comments(sender, **kwargs): instance = kwargs['instance'] instance.post.num_comments+=1 instance.post.save() from django.db.signals import post_save post_save.connect(handle_num_comments, sender=Comment) And the same code using COMEFROM class Post(models.Model): name = models.CharField(...) ... num_comments = models.PositiveIntegerField(default = 0) class Comment(models.Model): ... post = models.ForeignKey(Post) def save(self, *args, **kwargs): super(Comment, self).save(*args, **kwargs) instance = self LABEL .post_save def handle_num_comments(sender, **kwargs): instance = kwargs['instance'] COMEFROM .post_save instance.post.num_comments+=1 instance.post.save() So isn't the signals code a little like COMEFROM, and why is it superior to COMEFROM? … -
Django aggregation tutorial
One of the new and most awaited features with Django 1.1 was aggregation. As usual, Django comes with a very comprehensive documentation for this. Here, I have tried to put this in how-to form. Jump to howtos or Get source on Github. Essentially, aggregations are nothing but a way to perform an operation on group of rows. In databases, they are represented by operators as sum, avg etc. To do these operations Django added two new methods to querysets. aggregate annotate When you are have a queryset you can do two operations on it, Operate over the rowset to get a single value from it. (Such as sum of all salaries in the rowset) Operate over the rowset to get a value for each row in the rowset via some related table. The thing to notice is that option 1, will create one row from rowset, while option 2 will not change the number of rows in the rowset. If you are into analogies, you can think that option 1 is like a reduce and option 2 is like a map. In sql terms, aggregate is a operation(SUM, AVG, MIN, MAX), without a group by, while annotate is a operation … -
A response to Dropping Django
Brandon Bloom yesterday wrote an interesting post titled dropping Django. Despite a lot of hand waving(We needed a pragmatic template language to replace Django's idealistic one.), it raises some valid questions, so here is a solution to some of them. No support for hierarchical url creation. The simplest representation of nested urls I can think of is a nested tuple. Lets represent, the urls for a simple app by, >>> tree_urls = ('', 'list', ... ('edit/', 'edit', ('auto/', 'edit_auto')), ... ('^add/', 'add'), ... ('delete/', 'delete', ('hard/', 'delete_hard')) ... ) Guess what, urls.py is just a python module which excepts a variable names urlpatterns. Which means it is very easy to write a function which converts this nested structure to flat, structure. Here is a quick attempt at that, def merge(url): full_url=[] for i, el in enumerate(url): if i%2==0: full_url.append(el) full_url = ''.join(full_url) return full_url def combineflatten(seq): items= tuple(item for item in seq if not isinstance(item, tuple)) yield items for item in seq: if isinstance(item, tuple): for yielded in combineflatten(item): yield items+yielded def generate_flat_urls(tree_urls): """ >>> tree_urls = ('', 'list', ... ('edit/', 'edit', ('auto/', 'edit_auto')), ... ('^add/', 'add'), ... ('delete/', 'delete', ('delete/', 'delete_hard')) ... ) >>> generate_flat_urls(tree_urls) [('^$', 'list'), ('^edit/$', 'edit'), … -
Django-SocialAuth - Login via twitter, facebook, openid, yahoo, google using a single app.
TL;DR version: Here is an app to allow logging in via twitter, facebook, openid, yahoo, google, which should work transparently with Django authentication system. (@login_required, User and other infrastructure work as expected.) Demo and Code.Longer version follow: We are releasing our new app. Django-Socialauth. This app makes it awfully easy, to allow users to login your site using Yahoo/Google/Twitter/Facebook/Openid. A demo is available here. This is released under an Attribution Assurance License. A copy of the same is provided included with the code. After installing this app, you can use @login_required on any view and users identified via any means can access protected content. We provide services to integrate and implement this, for a low price of USD 1600. Please contact us at licenses@uswaretech.com to discuss your exact needs. The README is copied here for convenience. What it does. Allow logging in via various providers. Logging In This is a application to enable authentication via various third party sites. In particular it allows logging in via Twitter Gmail Facebook Yahoo(Essentially openid) OpenId Libs you need to install python-openid (easy_install) python-yadis (easy_install) python-oauth(easy_install) The API Keys are available from http://www.facebook.com/developers/createapp.php https://developer.yahoo.com/dashboard/createKey.html https://www.google.com/accounts/ManageDomains http://twitter.com/oauth_clients How it works. Openid: Users need to provide … -
Django gotchas
This is announcement about our new work, Django Gotchas, a teeny tiny ebook about commonly occurring gotchas with Django. Here is the readme copied from the project. Django-gotchas is a collections of gotchas which happen commonly when you are working with Django. They are some errors which I have made commonly or seen others do, these are not the errors which happen because they are hard to reason about, these are those errors which hapen when you close your eyes for a moment when coding. This is still very much a work in progress, released in the spirit of release early, release often. Click here to get it, or fork it on Bitbucket In Other news We have slightly updated the Django design patterns, though not the public website. cyrildoussin has done a lot of changes to Socialauth and made it much better. You can get it here . Thank! We will be merging this soon. -
Writing your own template loaders
Django has three builtin template loaders which are used to get the templates for rendering. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) Writing your template loader is a awfuly easy. It is a callable which Returns a tuple of (openfile, filename) if it can find the template. Raise TemplateDoesNotExist if the templates cannot be found. The simplest template loader can be from django.template import TemplateDoesNotExist def load_template_source(template_name, template_dirs=None): try: return open(template_name).read(), template_name except IOError: raise TemplateDoesNotExist, template_name if you put this to your template loaders directory, TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', 'dgrid.load_template_source' # 'django.template.loaders.eggs.load_template_source', You can do access a template using an absolute path. In [6]: get_template('/home/shabda/abc.txt') Out[6]: <django.template.Template object at 0x91c860c> In [7]: temp = get_template('/home/shabda/abc.txt') In [8]: temp Out[8]: <django.template.Template object at 0x9358a0c> In [9]: temp.render Out[9]: <bound method Template.render of <django.template.Template object at 0x9358a0c>> This is the first in the series of short and sweet Django posts we are going to do. You are interested, right. Do follow us on twitter or subscribe to our feed. We build Amazing We Apps. Talk to us or email us at sales@uswaretech.com . -
Django for a Rails Developer
This is not yet another Django vs Rails blog post. It is a compilation of notes I made working with Django after having worked on Rails for years. In this post I want to give a brief introduction to Django project layout from a Rails developer point of view, on what is there, what is not there and where to look for things. It should help a rails developer working on django be able to find the necessary files and underatnd the layout of the project files. Once you have both the frameworks installed on your system you can create the projects using the commands # creating a rails project rails rails_project # creating a Django project django-admin.py startproject django_project Lets look at the files and structure created by the respective frameworks #rails_project README Rakefile app/ controllers/ application_controller.rb helpers/ application_helper.rb models/ views/ layouts/ config/ boot.rb database.yml environment.rb environments/ development.rb production.rb test.rb initializers/ backtrace_silencers.rb inflections.rb mime_types.rb new_rails_defaults.rb session_store.rb locales/ en.yml routes.rb db/ seeds.rb doc/ README_FOR_APP lib/ tasks/ log/ development.log production.log server.log test.log public/ 404.html 422.html 500.html favicon.ico images/ rails.png index.html javascripts/ application.js controls.js dragdrop.js effects.js prototype.js robots.txt stylesheets/ script/ about console dbconsole destroy generate performance/ benchmarker profiler plugin runner server test/ … -
Django quiz
A quick django quiz. Answers available tomorrow. Get it as a text file (django-quiz) or on google docs or read below. ### Easy 1. You have a class defined as class Post(models.Model): name = models.CharField(max_length=100) is_active = models.BooleanField(default=False) You create multiple objects of this type. If you do Post.objects.get(is_active=False), what exceptions is raised? a. MultipleObjectsReturned b. ManyObjectsReturned c. SyntaxError d. MultipleModelReturned e. ManyModelReturned 2. Where is the function render_to_response defined? a. django.views b. django.shortcuts c. django.templates d. django.contrib.templates e. django.contrib.shortcuts 3. What is the default name for the table created for model named Post in application blog a. post_blog b. blog_post c. postblog d. blogpost e. Postblog 4. How do you send a 302 redirect using django? a. return HttpRedirectResponse() b. return HttpResponseRedirect() c. return HttpRedirectResponse(permanent=True) d. return HttpResponseRedirect(permanent=True) e. return HttpRedirectResponse 5. In django.contrib.auth, Users passwords are kept in what form? a. Plain text b. Hashed c. Encrypted d. Hashed then encrypted 3. Encrypted then hashed 6. Which of the following is correct way to find out if a request uses HTTP POST method? a. request.is_post() == True b. request.METHOD == 'post' c. request.METHOD == 'POST' d. request.method == 'post' e. request.method == 'POST' 7. Generic views have access … -
Python metaclasses and how Django uses them
Foss.in is without doubt India's largest FOSS technology conference. Lakshman gave a talk today on "Python metaclasses and how Django uses them". Here are the slides from that talk. Doing magic with python metaclassesView more documents from Usware Technologies. [Edit] Some reactions, http://twitter.com/jaideep2588/status/6295483833 http://twitter.com/kunalbharati/status/6296572939 And the talk images, http://twitpic.com/rxhn7 You should follow us on twitter and Subscribe to our blog -
Using bpython shell with django (and some Ipython features you should know)
What is bpython? bpython is a fancy interface to the Python interpreter for Unix-like operating system. says the bpython home page. It provides syntax highlighting, auto completion, auto-indentation and such stuff. Unlike iPython, which implements then entire shell functions and emulates the standard python shell, and adds enhancements, bpython just adds features on top of the existing python shell functionality, using the curses module. The "killer feature" of bpython is, as you can see from the image above, the IDE like prompting of the function parameters and the doc string of the function dynamically. I have always thought, what IntellijIDEA is to Java, IPython is to Python*. But bpython makes it more so, in terms of the code completion, which adds a lot of value to a ramping up developer. The only Python IDE that provides Source Assistant and Go-To-Source functionality conveniently, is the commercial one, Wing IDE Professional. Even with that, since all the defined models are replaced (by using meta-classes) in the runtime, that source assistant is not perfect. Newer versions of Wing seems to claim to obtain data dynamically at the runtime, but its not always comfortable to write code, keeping the IDE in a breakpoint. But … -
django-forum
twitter ready version: We have released a Django forum application, with some cool features not in any other Django based forum. You can get it here or see it in action. blog version There are quite a few Django based forum applications, so why another? Its a bit of a rhetorical question, as the answer is "none of them met my needs exactly, so we created my own", as you might expect. Without further ado here is a list of features. It is available on uswaretech.com/forum/. Based on, inspired by and ripped from PunBB. (Thanks!) PunBB like 3 phased hierarchy [Forum]->Subforum->Topic->Post Tightly integrated with Socialauth. (Screenshots) Gravatar support Moderation features (Close, stikify, make announcement etc.) Ajax based posting We are starting our forums based on this app, so we plan to be supporting and developing this for foreseeable future. Fork this on Github or check this out now. Screenshots Main page Post page Login Page We build amazing web apps. Contact us -
Doing things with Django forms
Forms are one of the best features of Django. (After models, admin, url routing etc :) ). Here is a quick tutorial describing how to do things with Django forms. Basic form Prob. You want to show a form, validate it and display it. Ans. Create a simple form. class UserForm(forms.Form): username = forms.CharField() joined_on = forms.DateField() This wil take care that the form is displayed with two text field, and a value for them are filled in, and the second field has correct formatting for a date. 2. Prob. Create a form which has values populated depending upon a runtime value, eg you might want to show only the values corresponding to the current subdomain. Ans. Create a form with an custom __init__. class UserForm(forms.Form): username = forms.CharField() plan = forms.ModelChoiceField(queryset = Plan.objects.none()) def __init__(self, subdomain, *args, **kwargs): self.default_username = default_username super(UserForm, self).__init__(*args, **kwargs) self.fields['plan'].queryset = Plan.objects.filter(subdomain = subdomain) Here in the __init__ we are overriding the default queryset on field plan. Any of the attributes can similarly be overridden. However the self.fields is populated only after super(UserForm, self).__init__(*args, **kwargs) is called. 3. Prob. The same form is used in multiple views, and handles the cleaned_data similarly. Ans. Create … -
Wordpress and Django: best buddies
Summary: How to integrate a non Django database system in your Django code, using Wordpress as example. The completed code is available at github or you can see some screnshots Though there are quite a few good Django blog applications, our blog is based on Wordpress. A number of plugin's make moving to a Django based app a bad decision for us, and not in the spirit of "best tools for the job". We moved the other way, and decided to use Django to admin the Wordpress database. The completed code is available on Github It is not too hard, with the the builtin Django commands. Django provides the inspectdb command which allows you to build your models.py from an existing non Django database. Here we will see the steps followed for Wordpress, but it would be about the same for all systems. Take a back up of wordpress mysqldump -u wordpress_user -p --database wordpress_database > data.sql Create a new project, and set its settings to use the Wordpress database. DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '' # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sqlite3. … -
Doing things with Django models - aka - Django models tutorial
Django abstracts most of the actions you would be doing with the Database. What it doesn't abstracts, and doesn't try to abstract is the Database modelling part. This is a quick tutorial describing to how model your data in Django models.py, and how to access and modify them. Consider a hypothetical HR department, which wants you to build an application to track and manage their processes. They have employees who work for a department, contractors who work for multiple department. Let's see how you you would do that in Django. from django.db import models class Employee(models.Model): name = models.CharField(max_length = 100) department = models.ForeignKey("Department") class Department(models.Model): name = models.CharField(max_length = 100) class EmployeeHistory(models.Model): employee = models.OneToOneField(Employee) date_joined = models.DateField() marital_status = models.BooleanField() class Contactor(models.Model): name = models.CharField(max_length = 100) departments = models.ManyToManyField(Department) Let's see the type of relationship we created here. An Employee has a Many-to-one relationship with Department, (i.e. One department will have many Employee, but one employee will have a single departments.) So Employee has a field department = models.ForeignKey("Department"). See that the ForeignKey field was added on the class which has in many. In database, this creates a FK from in Employee table which refernces Departments. A … -
Rails and Django commands : comparison and conversion
The most commonly used Rails commands and their Django equivalents Rails | Django rails console | manage.py shell rails server | manage.py runserver rake | None rails generate | None rails dbconsole | manage.py dbshell rails app_name | django-admin.py startproject/manage.py startapp rake db:create | manage.py syncdb The salient points to note are, Django has all commands via manage.py, Rails has it broken into rails and rake. Overall there are more Rails+Rake commands available than Django commands There is no one to one mapping between Rails and Django commands. Eg. There are no equivalent to rake doc:* or rake notes in Django. Similarly there is no equivalent to manage.py createsuperuser in rails. References http://docs.djangoproject.com/en/dev/ref/django-admin/ http://guides.rails.info/command_line.html http://github.com/uswaretech/Acts-as-Django/blob/master/commands.markdown -
Django is not flexible
Django is not flexible at all because you can not do simple things like. Using various authentication mechanisms. You can authenticate via Username, emails, Facebook, Twitter or any combination of these. Using different database backends. Use MySQL, PostgreSQL, Non-relational databases, more or a combination. Use different mail sending strategies. Send mail via smtp, queue to database, log to files and more. Different file storage method. Store locally, FTP, Amazon S3 or write your own. Store messages in Sessions, cookies or others. Cache things in Files, DB, Memcache or just fake it. Save sessions in files, DB, Memcache or cookies. Use Jinja, Mako or Gensi as templating library. One of the most lingering criticisms of Django has been that it is not flexible. People have criticised its design as too-tightly coupled, hard to extend, and inflexible. As a result, people have recommended to roll their own using SQLchemy, Jinja or web.py. I think this view is unfounded and wrong. You would be hard pressed to get the choices and flexibility which Django offers. Eg, while development I run with Sqlite, Dummy caching, and emails on console, while on production I switch to PostgreSQL, Memcache, and queued emails. Many apps use this … -
Getting trending Github projects via YQL
Github.com/explore allows you to see the trending Github topics. They use repopular.com for this, which use twitter retweets to find out the popular Github repos. Since neither Repopular, nor Github have a RSS of these trending repos, I wanted to get a list of these. Here is how easy it is with YQL. How we do it Go to YQL console. Give the SQL query to get the data from the webpage. where url="repopular.com" and css="div.pad a" is the magic which select the webpage, and also what DOM elemenst we are interested in. We get this data in JSON format which is munged to get the list of links. This list of links is passed via is_github_project which gets me just the Github projects. And we are done. PS. YQL is amazing. -
Importing wordpress
We now have a way to import wordpress to blogango, and all our old posts are on this blog. Thanks for reading. -
Seven reasons why you should switch to Vim
So you want a better IDE for developing django, huh? Why not give good old vim a try? Use pathogen to maintain your vim plugins (and sanity). Using this, you can clone the repositories listed here to .vim/bundle/ and start using them right away. Also, consider adding your .vimrc and .vim to a repository. Include .vimrc inside .vim and symlink .vim/.vimrc to ~/.vimrc to version control your .vimrc. My vim files can be found here. Also, here's an imgur album demonstrating these plugins in action. 1. Syntax highlighting for django templates Starting from vim 7.1, syntax highlight for django templates works out of the box. (Check your vim version using vim --version or :version within vim) If you are on an older version, use this plugin 2. Django snippets with snipmate SnipMate provides commonly used "snippets". This eliminates a lot of boiler plate code genreally required to start a django project from scratch. Django specific snippets can be found at robhudson's repository Its very easy to write custom snippets in case you need them. 3. On-the-fly error checking with pyflakes This one is not django specific, but it can save a lot of time spent debugging typos or silly mistakes. … -
Real time applications with Django, XMPP and StropheJS
TL;DR: django-pubsub allows you to create Twitter like real-time updates for your models with Admin like ease. Demo at http://chat.agiliq.com/pubsub/ Code at https://github.com/agiliq/django-pubsub Introduction: PubSub is a XMPP extension which allows publishing and subscribing to events. This is useful when you instantly want to notify many clients about something interesting happening on your server. Quoting the authors of PubSub specs: The protocol enables XMPP entities to create nodes (topics) at a pubsub service and publish information at those nodes; an event notification (with or without payload) is then broadcasted to all entities that have subscribed to the node. Pubsub therefore adheres to the classic Observer design pattern and can serve as the foundation for a wide variety of applications, including news feeds, content syndication, rich presence, geolocation, workflow systems, network management systems, and any other application that requires event notifications. To understand this better, think of newspapers as publishers and the people who subscribe to the newspapers as subscribers. Getting your daily newspaper is similar to checking your RSS feeds because you only get information at regular intervals. (Of course you could keep buying newspapers every 'x' hours, i.e. keep refreshing your RSS reader so often). This is as inefficient … -
Behind the Scenes: From HTML Form to Storage
In this post, we are going to see what happens behind the scenes when a file is uploaded to a django powered web application. An HTML form with a file input (atleast one) and encoding set to multipart/form-data is submitted. The MultiPartParser parses the POST request and returns a tuple of the POST and FILES data (request.POST, request.FILES). The MultiPartParser processes the uploaded data using the File Upload Handlers objects (through the new_file, receive_data_chunk and upload_complete methods). The request.FILES values are a sequence of instances of UploadedFile. In the django form, we pass the request.FILES MultiValueDict. These UploadedFile instances are validated by the full_clean method on the Form. The full_clean method in turn calls the _clean_fields method which calls the clean method on the forms.FileField and checks if the data is empty. After the form is successfully validated, we might assign and save the cleaned_data of the form to a model instance (or by saving the ModelForm). When the save method on the model instance is called, the save_base method calls a pre_save method on each field of the model. This pre_save method returns the value of the file instance bound to that FileField and calls it's save method. This … -
Haml for Django developers
Haml is taking the Ruby(and Rails) world by storm. Its not used as heavily by Python(and Django) developers as the Python solutions aren't as mature. I finally gave Haml a try and was pleasantly surprised how easy it was. The most mature Python implementation of Haml is hamlpy, which converts the hamlpy code to Django templates. Others are shpaml and GHRML Lets look at some templates from Django tutorial {% if latest_poll_list %} <ul> {% for poll in latest_poll_list %} <li><a href="/polls/{{ poll.id }}/">{{ poll.question }}</a></li> {% endfor %} </ul> {% endif %} Here is this template converted to Haml -if latest_poll_list %ul -for poll in latest_poll_list %li %a{'href':'/polls/{{ poll.id }}'}= poll.question You can see that this lost a lot of noise from the Django template. Being a Django programmer, significant whitespace is very pleasing. Here is another one from the same tutorial. <h1>{{ poll.question }}</h1> <ul> {% for choice in poll.choice_set.all %} <li>{{ choice.choice }}</li> {% endfor %} </ul> And converted to hamlpy %h1 = poll.question %ul -for choice in poll.choice_set.all %li = choice.choice Again, I lose a lot of noise from the templates, and the signifiant whitespace improve the chance that the out put would be valid html. … -
Behind the Scenes: Request to Response
In the previous installment of "Behind the Scenes", we saw how the control flows from Form to File Storage. Today, we are going to see how the application reacts from request to response. In this post, we are going to assume that we are using django's inbuilt runserver. The flow doesn't change much for other WSGI servers available. When you invoke the runserver management command, the command line options are validated and an instance of WSGIServer is created and passed the WSGIRequestHandler, which is used to create the request object (WSGIRequest). After the request object is created and the request started signal is fired, the response is fetched through the WSGIRequestHandler.get_response(request). In the get_response method of the request handler, first the urlconf location (by default the urls.py) is setup based on the settings.ROOT_URLCONF. Then a RegexURLResolver compiles the regular expressions in the urlconf file. Next, the request middlewares are called in the order specified in the settings.MIDDLEWARE_CLASSES followed by the view middlewares after matching the view (callback) function against the compiled regular expressions from the urlconf. Then the view (callback) is invoked and verified that it does not return None before calling the response middlewares. You can see the pictorial … -
Getting started with South for Django DB migrations
South is a migration tool used with Django.There will be times when you would be adding fields to a model or changing the type of field (eg: Field was an IntegerField and you want to change it to FloatField). In such cases syncdb doesn't help and South comes to your rescue. There were times when i tried "python manage.py migrate southapp", got some error and then tried "python manage.py migrate southapp 0001 --fake". In some cases, that worked. When it did not work, i tried something else and so on. There were confusions regarding what --fake does and why it does so. In this post, i intend to remove(lessen) that confusion. We will be seeing some scenarios which will help us understand south better. At various points, we will intentionally make some mistakes and will rectify them later. Also, we keep looking at our database schema as we go. Scenario 1: Using south on a brand new app. Let's create an app named "farzi_app". python manage.py startapp farzi_app In settings.py, add 'south' to INSTALLED_APPS and run syncdb. python manage.py syncdb Running syncdb creates a table named 'south_migrationhistory' in your database. This table 'south_migrationhistory' keeps a track of all the migrations …