$
python3 manage.py test functional_tests --liveserver=superlists-staging.ottg.eu
[...]
selenium.common.exceptions.NoSuchElementException: Message: 'Unable to locate
element: {"method":"id","selector":"id_new_item"}' ; Stacktrace:
[...]
AssertionError: 'To-Do' not found in 'Welcome to nginx!'
Progress!
Deploying Our Code Manually
The next step is to get a copy of the staging site up and running, just to check whether
we can get Nginx and Django to talk to each other. As we do so, we’re starting to move
into doing “deployment” rather than provisioning, so we should be thinking about how
we can automate the process, as we go.
One rule of thumb for distinguishing provisioning from deploy‐
ment is that you tend to need root permissions for the former, but we
don’t for the latter.
We need a directory for the source to live in. Let’s assume we have a home folder for a
nonroot user; in my case it would be at
/home/elspeth
(this is likely to be the setup on
any shared hosting system, but you should always run your web apps as a nonroot user,
in any case). I’m going to set up my sites like this:
/home/elspeth
├── sites
│ ├──
www.live.my-website.com│ │ ├── database
│ │ │ └── db.sqlite3
│ │ ├── source
│ │ │ ├── manage.py
│ │ │ ├── superlists
│ │ │ ├── etc...
│ │ │
│ │ ├── static
│ │ │ ├── base.css
│ │ │ ├── etc...
│ │ │
│ │ └── virtualenv
│ │ ├── lib
│ │ ├── etc...
│ │
│ ├──
www.staging.my-website.com│ │ ├── database
│ │ ├── etc...
140
|
Chapter 8: Testing Deployment Using a Staging Site