Day 10 - Python/Django Update

Good news, may be I should be able to finish the first app of my life by tomorrow EOD.

Nothing better than closing a year and starting a new one.

I am building this simple blog app with a simple tutorial I found online, its basically from a snippet of the book " Python Web development with Django".

The learning so far is that dont trust the tutorials implicitly. They assume a lot of things, and but for obvious things.

So, its ok for someone who is already conversant with one language to be able to pick up the gaps in a tutorial, its not so, if you are completely a beginner.

Like, while making this app so far, I encountered a lot of error-:

1. Indentation - Python is very strict on it. Then I found that I should use the tab two times and it solved the problem.

2. AttribueError : 'module' object has no attribute 'Charfield' .
While using the "syncdb" command after creating the model and trying to sync with the database, I was getting this persistent error and I was stuck for more than 2 hours.

Would you believe that what could be the reason, for you to be able to sync to a database, you should have created the database in the first place. Haaa!!!

That was not there in the first place, I wasted a lot of time on searching for it. Fixed a couple of things like my _init_.py file of the app was empty, re-configured it.

3.The sqlite3 path in the settings.py file was wrong, I fiexed it.

4.The name of the app in the INSTALLED APPS tupple was not correct, fixed it.

5. The path name of sqlite3 databse has to be in forward slashes and not in the windows format of backward slashes.

And then after creating the database, when I ran the "syncdb" command, everything went like a whistle.

Imagine, this step was there in the book after the model has been created.

And its a complete step-by-step tutorial after you have installed django.

So, a good day, wuite a few learnings.

Comments

Popular posts from this blog

Coursera - CS 101 - Completed