Django “no such column” error

February 13th, 2010

I’ve been getting into Django recently. I’ll go into it more in another entry, but I ran into a small issue where my database seemed to get out of sync with my model. Running syncdb didn’t throw any errors, but when I tried to access the model from the server I’d get an error about “no such column”, even though I could see it created in the generated DDL.

It took me a bit of digging (in other words, it wasn’t in the tutorial), but there’s a manage command to reset the database for a particular app. Running that and re-syncing my database got me moving again.

python manage.py reset [appname]
python manage.py syncdb

4 Responses to “Django “no such column” error”


  1. Adam

    What are you using DJango for? I’m learning it as part of getting Reviewboard up and running. I’m trying to do a Debug apache setup, as the Fedora Account system needs amulti threaded server, and manage.py isn’t.


  2. Dimitris Glezos

    Jay, you might also want to try South, which handles schema migration for you pretty nicely.

    Tip: syncdb support –noinput to avoid asking you for an admin account. You can run `manage.py createsuperuser` later on.

    Adam, this might interest you: http://github.com/jaylett/django_concurrent_test_server

    Guys, do drop by #transifex on Freenode or find me there if you think I can be of any help. =)


  3. Jay

    Adam – Just personal growth. I’ve gotten pretty into Python lately and have a list of things I wanted to look into. I’m doing a sprint backlog tracker as a pet project app, but I don’t know how far I’ll go with it. Also on the list are things like TurboGears and PyGTK.

    Dimitris – Thanks for the heads up, I’ll add that to the aforementioned list. :)


  4. Andrew A. Sailer

    Thanks for your article. I am new at django and this will be a big help.