Missed a couple of consecutive days, but work is keeping me busy. Still, let’s talk about my second day of learning…
Much of what I covered during this 1/2 hour of instruction was the installation of Django, using virtualenv, and setting up my first data model. I’m familiar with MVC frameworks; they are used all over the place. In the case of Django, it’s basically learning this design pattern all over again, though within the Pythonistic mindset.
Here’s a quick look at the code:
Basically, this code is defining the database schema that will be used to create the Article table in the backend database. We’re saying that inside the database for this Django app, we want a table called ‘Article’ that has the following fields (or columns) defined:
Django converts this ‘model code’ into actual SQL statements, which are used to create the table. The syncdb command is the magic that performs this. After completing this portion of the lecture, we went into the python interactive shell, and actually created a couple of Articles (i.e row data in the table). Later today, I’ll tackle lecture 3.