# Nghiên cứu website shuffey
### Các công nghệ sử dụng:
- Nginx: Web service.
- Python - django: Phần backend, tạo application, tạo access token để triển khai các ứng dụng.
- ReactJS: Frontend
- postgreSQL: Database
- Ubuntu 20.04: Hệ điều hành sử dụng để test
### Cài đặt, triển khai backend
- Cài đặt postgreSQL: https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart
- Cài đặt python và các package cần thiết:
```
apt-get install software-properties-common
apt-add-repository universe
apt-get update
apt-get install python3-pip
apt-get -y install libjpeg-dev zlib1g-dev build-essential gzip libffi-dev libpq-dev libssl-dev nginx python-dev python-docopt python3-humanize python3-pip python-setuptools python3-cached-property python3-colorama python3-oauthlib python3-jsonschema
pip3 install boto3
pip3 install --upgrade awscli cryptography django django-braces django-cors-middleware django-countries django-extensions django-oauth-toolkit django-storages djangorestframework geoip2 gunicorn olefile Pillow psycopg2 pytz PyYAML requests six testresources texttable websocket-client
sudo pip3 install virtualenv
```
- Khởi tạo virtualenv
```
virtualenv newenv
source newenv/bin/activate
```
- Đưa code vào thư mục /home/ubuntu
- Chỉnh sửa các thông số như connect database, tên miền triển khai ứng dụng tại file `shuffey/settings.py`
- Cài đặt package cần thiế của dự án
```
cd /home/ubuntu
pip3 install -r requirements.txt
```
- Migrate, tạo ra các bảng cần thiết
```
python3 manage.py migrate --noinput
```
- Load các dự liệu khởi tạo vào database
```
python3 manage.py loaddata membershipplan.json
```
- Chạy server ở cổng 8000
```
python3 manage.py runserver 0.0.0.0:8000
```