..

Three Things That Went Wrong in Django's Tutorial and How to Fix Them

I’ve been working on moving this posts to a platform that I can appreciate. I’d rather use a framework the uses Python,so I can understand it and hopefully add to it at some point.  It could also be because I’m never at rest and I really enjoy playing.

UTF-8 Issue and the Database. It seems that the VPS provider during the install of the OS, just sets the local language be an ASCII setting.  However, when sifting through the Django documentation I discovered that UTF-8 is required for the databases tables.  Since I used the package manager to install the database, it picked up the locale language settings.  Essentially, the database wouldn’t then allow any characters into the tables.  I tried fixing this at the OS level by running:

Which did show that UTF was set.  However, even after a complete re-install PostgresSQL refused to inherit the UTF setting.  I found a Gentoo wiki on how to fix the Postgres’s template1.

When I ran through the initial setup of the database, the very first time I saw a few errors.  Specifically when running:

Turns out there was an error and a table wasn’t populated during the syncdb operation.  I’m, not sure why but one of the tables wasn’t populated.  I believe it’s a SITE_ID table.  Anyway, here is what I used to fix it:

After fixing the SITE_ID table, I was able to get to the actual admin page… however, I realized I had never created a superuser, and password for the site. It’s slightly difficult to run a page as an administrator, without a super user.  It’s pretty easy to create a superuser:

This will prompt you for a username, and password…

does return a UTF-8.  From what I could tell in my research was that the easiest way to fix this was with the fixing the .bashrc file, and appending a couple commands at the end of the file so:

Then append the following:

After that it was smooth sailing of the Django Tutorial.