Background Image
Table of Contents Table of Contents
Previous Page  155 / 478 Next Page
Information
Show Menu
Previous Page 155 / 478 Next Page
Page Background

Figure 7-3. The lists page, with all big chunks…

That’s it! Definitely time for a commit:

$

git status

# changes tests.py, base.html, list.html + untracked lists/static

$

git add .

$

git status

# will now show all the bootstrap additions

$

git commit -m"Use Bootstrap to improve layout"

What We Glossed Over: collectstatic and Other Static

Directories

We saw earlier that the Django dev server will magically find all your static files inside

app folders, and serve them for you. That’s fine during development, but when you’re

running on a real web server, you don’t want Django serving your static content—using

Python to serve raw files is slow and inefficient, and a web server like Apache or Nginx

can do this all for you. You might even decide to upload all your static files to a CDN,

instead of hosting them yourself.

For these reasons, you want to be able to gather up all your static files from inside their

various app folders, and copy them into a single location, ready for deployment. This

is what the

collectstatic

command is for.

The destination, the place where the collected static files go, is defined in

settings.py

as

STATIC_ROOT

. In the next chapter we’ll be doing some deployment, so let’s actually ex‐

periment with that now. We’ll change its value to a folder just outside our repo—I’m

going to make it a folder just next to the main source folder:

What We Glossed Over: collectstatic and Other Static Directories

|

127