News app for the Nov. 9-11 training at Mizzou.
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with cjdd3b:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Mizzou news app

News app for the Nov. 9-11 training at Mizzou.

Getting started

There are two ways you can get started using this app: cloning it from git or building it from scratch (like we did in class). We’ll talk about the cloning option first.

Cloning from git

Cloning the app from git will allow you to have a full functional version of the app on your desktop from the get-go, rather than having to rebuild it yourself. This will let you play with the code, make changes, and see how those changes affect the app.

Cloning is easy. If you have git installed, simply navigate to the Desktop (or any other directory you prefer) on the command line and type:

git clone git://

You should see the application download into a new folder called mizzou-newsapp. For students who attended the class, you should already have all the necessary Python libraries installed. For those who don’t, you can quickly install them like so using Python’s handy pip utility:

cd mizzou-newsapp
pip install -r requirements.txt

Once that’s complete, simply navigate into the base mizzou-newsapp directory, which contains, and type:

python runserver

The app should start as normal. Remember that you can view it in your browser at the address

Starting from scratch

To build this application from scratch, as we did in class, requires a few more steps. Start by installing django using the standard pip install django command. Then navigate to the directory of your choice and start a new project like so: startproject mizzou

You’ll see a new directory structure be created for your project. Navigate into the directory, and then into the separate mizzou subdirectory underneath it. Now you’ll want to configure your DATABASES setting to create a new SQLite database. The easiest way to do that is to copy the settings from this repository and paste them into your local copy.

Next you’ll have to set up your database. Navigate back to the directory where your file is stored and type:

python syncdb

Follow the prompts to create a superuser while you’re at it.

Enabling the admin

Now you should enable the admin interface, which requires uncommenting several lines of code in two places: and

Django includes instructions on which lines to uncomment in each file. Do the uncommenting first (note the two lines toward the top, and one in the actual tuple of URLs). Now find the INSTALLED_APPS setting toward the bottom of and uncomment the admin line as directed.

If you navigate to in your browser you should now see the admin interface. You can log in using the superuser you created earlier.

Creating your first app

Remember that Django projects are divided into two basic units: Projects, which you created already with the startproject mizzou command; and Apps, which are the sets of models and views that compose each chunk of a project.

The way we learned in class, all of your apps should be stored in a directory called “apps” in the same subdirectory as your file. To create that on a Mac, navigate to the proper place and type:

mkdir apps
cd apps

Remember we need the file for Python to be able to access the directory.

The next thing we’ll do is create an app for our Dispatch records. Navigate into the apps directory you just created and type: startapp dispatch

You should see a new folder appear with a models, views and tests file.

Finally, you need to hook up your app to the INSTALLED_APPS setting in your file. Open that and add 'mizzou.apps.dispatch', to your INSTALLED_APPS setting.

Models, templates and views

If you’ve made it this far, your project is pretty much set up. All you need to do now is fill in code for the models, views, URLs and templates.

The code in this repository is your best reference if you’re looking to recreate the project from scratch. Recall that:

Models are a wrapper around your database. They let Django query your data without the need for SQL. You should build these first.

Views are where the business logic of the application live. They are represented as functions that take a request as input and return a response.

URLs are like the traffic cop that tells incoming requests where to go. They are a mapping of URL patterns to specific views.

And Templates are the HTML files that the view renders in its response.

Other notes

  1. This app includes a fully functioning SQLite database of dispatch that you can use in your work. You’ll find it in mizzou/data/dispatch.sqlite. To enable it, simply copy the database settings from this project into your local copy.
  2. The web scraper we built in class is also included in this project. You’ll see it in mizzou/bin/