Fred has lived in Ypsilanti Michigan his whole life. He lives with his wife, 3 year old daughter and pet dog Dino. Every weekend he would either spend the day with his family at the park or with his friends at a local restaurant having debates about current events. Once the pandemic caused a lockdown, Fred found himself spending a lot more time at home. With the exception of taking the dog for walks and getting emergency groceries, a lot of his time is now spent in the living room, also known as the makeshift preschool, with his daughter.
Fred’s wife works as a general physician, and while she does not directly interact with covid patients, she gets a glimpse of the front lines daily and tells her husband about it after work. Their daughter had just started preschool before the pandemic arrived but now learns from home from her dad. She is quite happy about this.
Even though Fred lost his job, he is not immediately worried about money to sustain his family. He and his wife have a backup saving account for just such an occasion, although he is worried about how long the pandemic will last, and is constantly following the trends.
A lot of Fred’s social activities have turned into virtual ones, and he has relied on webex to facilitate them. Current events are still the topic that he and his friends debate on since the lockdown has been almost exclusively about COVID. His friends argue that they should go out and meet up more to help avoid more devastating news, like their favourite restaurant closing down. He tries to argue against it using articles he reads in the paper and announcements on the television but is usually dismissed because “those articles are serving a political agenda” some of his friends would say.
Thinks: If he had other sources of data that were unbiased and visual, he would win all the debates with his friends.
Sees: He sees the negative effects that the quarantine has had when he takes his dog for walks, he however also knows the far worse consequences if the safety measures were ignored.
Feels: Remorse for people who lost their businesses and jobs. (Himself being one of them)
Does: Fred looks up statistics every morning before his wife goes for work and reads a more detailed article later in the afternoon.
In order to set up and run the project you will need to have Python 3.8 and Django 3.1.1 or later installed.
You can either install python directly on your machine or use a python engine such as Anaconda. It is advised to run Python inside a virtual environment.
1a. Run python -m pip install --upgrade pip
OR
1b. pipenv install
(** NOTE: pipenv is preferred)
pip install -r requirements.txt
. This will install the required packages.To ensure that all members' database is up to date and avoid migration errors, run the following command whenever a change has been made to the database or, to be safer, whenever you pull a new version of the project from github.
python manage.py makemigrations
python manage.py migrate
There are two options you can take to run the server, either:
manage.py
is, run python manage.py migrate
. This sets up the database.
(Currently SQLite)python manage.py runserver
or
python manage.py run
this is a custom command that will run the migrations and the serverIf you are inclined, you can run the project using docker. Docker sets up a virtual container that holds an instance of the django project, as well as an instance of a postgres database. In order to set this up and get it running, follow these steps:
postgres_password.txt
on the datatitans/cred/
directory. This will hold the postgres instance password. Simply make any password.cosc481w-581-2020-fall-datatitans
directory.docker-compose up -d --build
This will create a container with a copy of the current version of the project. Once it is finished you should have a similar terminal screen
And your docker desktop application should look like this. One container named, with 3 images below
Hover over the image ending in datatitan_site_1
and select the cli button. This will open up a new terminal
Inside the terminal run pipenv shell
and cd datatitan_site
Run migration, python manage.py migrate
Run python manage.py populatedata
to update the database
You should now be able to run python manage.py runserver 0.0.0.0:8080
to start up the server. Note that the port is now 8080 to avoid conflict with your regular django setup. Accessing the site in the browser will be at 127.0.0.1:8080
.
Another note: it may take a little while to connect.
In order to close the container once done working on the site, run the following command:
cosc481w-581-2020-fall-datatitans
directory, run docker-compose down
. This will close and remove the container.python manage.py createsuperuser
127.0.0.1/admin
These instructions detail how to access our AWS server via PuTTY.
Notes: • Currently, the user information is for Chisulo’s account. If others are going to be working with AWS, we will need to create our own IAM accounts.
• For now, we will continue to do all project edits through GitHub. So we only need to access the AWS server to upload working releases.
If you do not have PuTTY installed, you can download it here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Before starting PuTTY, download the authentication key here: https://drive.google.com/file/d/1JcfkE_vzwfANi76w5tOlJ-426tpZrVQG/view?usp=sharing
Open PuTTY, you will see the Configuration screen (Image 1):
Per Image 1, with Session selected in the Category column on the left:
Image 2:
Per Image 2, select Auth in the Category column and:
Image 3:
Per Image 3, choose Connection from the Category menu:
Image 4:
Per Image 4, after clicking on Session again:
Type "exit" to quit
site
directorysource django/bin/activate
screen
. This creates a new terminal screen.python manage.py runserver 0.0.0.0:8000
Ctrl + a
then Ctrl + d
if on Windows. Cmd + a
then Cmd + d
on Mac. Running this will detach the screen from your terminal sesssion so it can continue to run even when you disconnect from the server.screen -d -m python manage.py runserver 0.0.0.0:8000
screen -r
. This will re-attach the screen the server is running onCtrl + c
127.0.0.1
.
Attempting to connect to the server through localhost
WILL fail.
We could add localhost
to the list of allowed hosts, but it isn't currently a priority.