CMPUT404-project-socialdistribution
See the web page for a description of the project.
Make a distributed social network!
Link: https://azuredsn-889a4fb9b2bb.herokuapp.com/
Docs: https://azuredsn-889a4fb9b2bb.herokuapp.com/api/docs
https://www.youtube.com/watch?v=ZJmXECT2B4o
- Whitesmoke
- Mistyrose
- Cornflowerblue
- Darkgoldenrod
Note: Connection with Darkgoldenrod's node is sometimes interrupted by a HTTP 429 error ("Request was throttled")
MIT License
Khyl Nad
Quin Nguyen
Kyle Quach
Crystal Zhang
Cinguinique Erquette
Nathan Wu
srcfolder contains the source code for the frontendpublicfolder contains the static files (logo, static assets, etc.)componentsfolder contains the React componentsComponentNamefolder contains the React componentComponentName.tsxcontains the React componentComponentName.module.scsscontains the CSS for the React component
utilfolder that comtains non-React codelibNamefolder of a library of helper functionslibName.tsfile of helper function
App.tsxcontains the main React componentindex.tsxentry point for the React appApp.module.scsscontains the CSS for the React appindex.csscontains the global CSS.envcontains the environment variables (not included in the repo, make one locally)package.jsoncontains the dependencies and scriptspackage-lock.jsoncontains the dependencies and scriptsbun.lockbbinary lockfile for Bun (if using Bun over npm)
tsconfig.jsoncontains the TypeScript configuration
-
serverdirectory is the base directory for the django project -
azureDSNdirectory is the django app containing the files for the entire backendserializersfolder contains serializer class for each modelmodel_serializer.pycontains the serializer class
utils: folder contains the general-purpose functions or helpers that can be reused across the entire project
-
to make database migrations locally, cd into the
backenddirectory and run,python3 manage.py makemigrations azureDSNthen,
python3 manage.py migrate -
requirements.txtcontains all the required packages to run the django project-
if changes have been made to the requirements, run
pip install -r requirements.txt -
if you installed new packages locally make sure to run,
pip freeze >| requirements.txt -
after installing the new package so that it is added to the requirements.txt file. Commit this file.
-
Since the backend and frontend are separated in a monorepo, both need to be setup differently.
You must cd into each directory separately. Two terminals are required to run both servers, unless you are using something like tmux.
cdinto the frontend directory- Run
npm ito install the dependencies - Create a
.envfile in the root directory of the frontend directory- The
.envfile should contain the following variables:REACT_APP_API_BASE_URL="http://localhost:8000" # Change this to the correct URL in prod
- The
- Run
npm startto start the development server
cdinto the backend directory- Create a virtual environment
- Run
python3 -m venv .venvto create a virtual environment - Run
source .venv/bin/activateto activate the virtual environment- if you are using VSCode you can automatically activate the venv every time by setting the interpreter to the venv python interpreter.
- Run
- Run
pip install -r requirements.txtto install the dependencies - run
python manage.py makemigrationsto make the database migrations - Run
python manage.py migrateto migrate the changes to the database - Run
python manage.py runserverto start the development server
Note: The lock files in the root directory should be up to date before deploying
- The lock files should NOT be used for development, only for deployment
- Make sure the lock files in the root directory are up to date
- If they are not, copy the lock files from the frontend and backend directories into the root directory
- Merge into prod
- Merge prod into deployment (it should auto deploy)
- Use buildpacks nodejs and python
- After first deploy, run migrations and create superuser
- Config vars:
- Run
python manage.py collectstaticin backend folder if frontend does not display.