# 568 HW1
## Basic info
Jerry's token: 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
Leo's : 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
卓爾哥哥開示: https://drive.google.com/file/d/1flBUi4LtNlwEzsiGYJCJE2tZz3G-oJUS/view?usp=sharing
ECE 568 Guide: https://neat-iodine-05e.notion.site/ECE-568-Guide-1e5d5cfcfb694952acd74ae869f8cdd1
GitHub: https://github.com/leowindows7/test/tree/dev
Trello進度表: https://trello.com/b/esUnNvpR/duke-568
[Django tutorial](https://docs.djangoproject.com/en/3.0/intro/tutorial02/)
MDN tutorial [here](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django)
## macOS setting
`ssh ch450@vcm-24016.vm.duke.edu`
`Netid password`
## Project Setting
### Project setup
1. create a directory for your django project
3. run `django-admin startproject [your project name]`
4. creat application with `python3 manage.py startapp [your application name]`
5. registerd your application in `[project]/[project]/setting.py` INSTALLED_APP
6. specify the database, more on database setting [here](https://docs.djangoproject.com/en/3.2/ref/settings/#databases)
7. url mapping
8. do `python3 manage.py makemigrations`, and then `python3 manage.py migrate`, [here](https://docs.djangoproject.com/en/3.2/topics/migrations/) for more info on ***migration***
9. run `python manage.py runserver`, more info about ***runserver***, visit [here](https://docs.djangoproject.com/en/3.2/ref/django-admin/#runserver)
`python3 manage.py runserver 0.0.0.0:8000`
settings.py
ALLOWED_HOSTS = ["vcm-24016.vm.duke.edu", "vcm-24005.vm.duke.edu", "127.0.0.1"]
### Database setup
1. `sudo su - postgres`
And there would be a postgres=#
type:
`ALTER USER postgres with encrypted password 'postgres';`
`ALTER ROLE`
And type:
`\q`
`exit`

2.
```
cd /etc
cd postgresql
cd 10
cd main
sudo emacs pg_hba.conf
```
Find the first row of local, and change the last column from **peer** to **md5**
Store the file, and exit.

```
sudo service postgresql restart
cd ~
cd test
cd firsthomework/
python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000
```
### Login config
https://learndjango.com/tutorials/django-login-and-logout-tutorial
ALTER USER postgres with encrypted password 'postgres';
### 架構圖

# Record
My Ride Info: Passenger
Edit Passenger: Passenger(Confirmed後就沒東西了)
My Confirmed Ride: Passenger
**~~User Info: 還沒做!!!!!!(mainpage的地方show使用者名字)~~**
Go for a Drive: Driver(尚未confirmed)
~~**Edit Passenger: 洗不掉舊的紀錄**~~
~~**My Confirmed Ride(Driver) : Driver**~~
~~**Email**~~
**Docker**
~~**Join Ride的邏輯bug**~~
mzkmbeshyhljepjq