Things to Remember

Still really liking Django (and by extension, Python).  Some things are a bit tricky to figure out, but overall, it’s really easy to use and can be a very powerful tool for developing on the web.

Deploying to a live server can be one of those tricky areas.  Django makes it super easy to build locally, including a server with it’s package.  However, eventually, you’ll want to put your creation somewhere on that world wide part of the web.  The project I’m working on already had a server available, so I FTP’d all the files to the right directory, remote logged in, hit my manage.py runserver command, and opened my browser to check it out.

And saw a debugging error telling me there was an invalid object.  I’d become somewhat familiar with the error messages Django throws during the initial development, but this one had me stumped.  I checked the schema- all looked right.  I double checked my models and they looked fine.  I’d even installed South (the project requires Django 1.6- don’t ask me why), but it couldn’t find any issues.

Then I realized that I’d tested this all locally, but never actually run an initial migration on the remote server.  The error was telling me there was an invalid object because the view was trying to access an object that simply hadn’t been initialized.  I ran a syncdb command on the remote server and everything started working!

So, I guess the moral is to try not to forget those first steps.  I hadn’t really checked anything locally when first setting up the project- I hadn’t opened the site in a browser into quite a way into the initial process, so hadn’t seen this issue.  I went back and typed out a startup guide so I wouldn’t forget.  Eventually, I’ll remember these things automatically, but for the meantime, it’s always good to have a backup.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s