- Clone repo
git clone git@github.com:COSC-499-W2023/year-long-project-team-8.git - Navigate to project
cd year-long-project-team-8 - Create a virtual environment in root
python -m venv venv
- Activate virtual environment
- Windows:
venv/Scripts/activate - Linux/Mac:
source venv/bin/activate
- Windows:
- Navigate to
drfdirectorycd app/drf - Install backend dependencies
pip install -r requirements.txt - Navigate to
backendcd backend - Create a
.envfile and add yourEMAIL_HOST_PASSWORDfor SendGrid API key andSECRET_KEYfor your Django project (Ask us what this is by emailingpasstheplate9@gmail.com) - Run migrations to set up local DB
python manage.py makemigrationspython manage.py migrate - run server locally
python manage.py runserver 0.0.0.0:8000 - The backend server is now up and running and is ready for communication with the frontend server
- to access Django Rest Framework web GUI, you may need
python manage.py runserver
- Development server available at
http://127.0.0.1:8000/- for admin access
http://127.0.0.1:8000/admin/ - to create an admin user
python manage.py createsuperuser
- for admin access
- Upon setting up the environment, both
frontendandbackendservers can be launched with fromproject rootwith:./startservers.bat- on Mac/Linux
chmod +x startservers.sh./startservers.sh
- on Mac/Linux
How to run:
- Configure the front end, see frontend instructions and install expo go on the device, navigate to
\app\drf\front-endand run:
npx expo start
- Scan the QR code and pass those plates
- Back-end hosted using pythonanywhere.com using a MySQL
database. Free tier hosting, as the app scales will need to upgrade the tier or change the hosting platform. Request login credentials by sending an email to
passtheplate9@gmail.com - All endpoints live at passtheplate.pythonanywhere.com/api
- Can access the admin portal at passtheplate.pythonanywhere.com/admin (will need to make a new superuser in python anywhere)
- For changes to be reflected on the server, will need to open Bash the console on pythonanywhere.com and pull remote changes into the production branch. The Production console is set up, just need to run the git pull
- To make any changes on the server console (push, pull), you will need to authenticate your GitHub account with email and token because it is a private repo (this will change if REPO is made public). You can generate your token following these steps, make sure to save it as you will need it every time you try to pull changes onto the server. Make sure to allow all permissions on the token. https://www.geeksforgeeks.org/how-to-generate-personal-access-token-in-github/
- Install Node.js
- Download the Expo Go app on your smartphone and/or set up an emulator on your computer (e.g., Android Studio for Android or Xcode for iOS).
- Clone Repository
git clone git@github.com:COSC-499-W2023/year-long-project-team-8.git - Navigate to project directory
cd year-long-project-team-8/app/drf/front-end - Run
npm install - Create a
.envfile at the root of the project directory and add yourGOOGLE_API_KEY - Make sure your computer and smartphone are connected to the same Wi-Fi
- Run in
front-endnpx expo start - Setup Config
- Retrieve the IP address from the terminal after starting
npx expo startwhere it saysexp://<your-ip>:8000 - Go to
app/drf/front-end/config.js - Locate the line
export const baseEndpoint - Place
<your-ip>into baseEndpointhttps://<your-ip-here>:8000/api
- Retrieve the IP address from the terminal after starting
- To view app
- On a smartphone: Scan the QR code that appears in the terminal with the Expo Go app.
- On an Android emulator:
- Download an emulator
- Start the emulator
- Press
ain the terminal
- On an iOS emulator:
- Select a device
- Start the emulator
- Press
iin the terminal.
- Press
?in the terminal while the Expo server is running to see a list of all available commands.
- Available on Play Store for Internal Testing
- Request the testing link by sending an email to
passtheplate9@gmail.com - Click on the link and download the app
- Use as any other app on your phone
| HTTP | Endpoints | Action |
|---|---|---|
| POST | /api/products | Create a new product |
| GET | /api/products | Retrieve a list of all products |
| GET | /api/products/?search=${query} | Search for products with a query |
| GET | /api/products/?categories=${categories} | Filter products by category |
| GET | /api/product/${productId} | Get product details |
| PATCH | /api/product/${productId} | Update product details |
| DELETE | /api/product/${productId} | Delete a product |
| GET | /api/products/?owner=${userId} | Receive products linked to the owner |
| GET | /api/users | Get user list |
| POST | /api/users | Create a new user |
| GET | /api/users/${userId} | Get user details |
| PATCH | /api/users/${userId} | Update user details |
| DELETE | /api/users/${userId} | Delete a user |
| GET | /api/my-products | Get user-owned products |
| GET | /api/images | Get images associated with a product |
| POST | /api/reviews | Submit a review |
| POST | /api/token | Validate login credentials and receive tokens |
| POST | /api/token/verify | Verify current tokens |
| POST | /api/token/refresh | Refresh access token |
| POST | /api/auth/change-password | Send password reset code |
| PATCH | /api/save_posts | Toggle saved post for user |
| GET | /api/chat/list | Get list of chat instances |
| GET | /api/chat/${chatId} | Get chat messages for chat instance |
| POST | /api/chat/${chatId} | Send chat messages for chat instance |