![Show Menu](styles/mobile-menu.png)
![Page Background](./../common/page-substrates/page0034.png)
If, instead, you see an error trying to import Selenium, you might
need to go back and have another look at the
Prerequisites and As‐ sumptionschapter.
For now though, we have a
failing test
, so that means we’re allowed to start building our
app.
Getting Django Up and Running
Since you’ve definitely read
Prerequisites and Assumptionsby now, you’ve already got
Django installed. The first step in getting Django up and running is to create a
project
,
which will be the main container for our site. Django provides a little command-line
tool for this:
$
django-admin.py startproject superlists
That will create a folder called
superlists
, and a set of files and subfolders inside it:
.
├── functional_tests.py
└── superlists
├── manage.py
└── superlists
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
Yes, there’s a folder called
superlists
inside a folder called
superlists
. It’s a bit confusing,
but it’s just one of those things; there are good reasons when you look back at the history
of Django. For now, the important thing to know is that the
superlists/superlists
folder
is for stuff that applies to the whole project—like
settings.py
for example, which is used
to store global configuration information for the site.
You’ll also have noticed
manage.py
. That’s Django’s Swiss Army knife, and one of the
things it can do is run a development server. Let’s try that now. Do a
cd superlists
to
go into the top-level
superlists
folder (we’ll work from this folder a lot) and then run:
$
python3 manage.py runserver
Validating models...
0 errors found
Django version 1.7, using settings 'superlists.settings'
Development server is running at
http://127.0.0.1:8000/Quit the server with CONTROL-C.
6
|
Chapter 1: Getting Django Set Up Using a Functional Test