Skip to content

tientrinh21/exchangelicious

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exchangelicious

Savor the Flavor of Global Exchange!

Hero image

Local Development guide

The current setup is inspired by this video: https://www.youtube.com/watch?v=OwxxCibSFKk (main difference is he uses the page router and I use the newer app router)

⚠️ Please make a pull request instead of pushing straight to the main branch

Prerequisites

Setup

  1. Create your own .venv with in the folder called server

    • Create your own virtual environment (venv): python -m venv .venv
    • Activate the venv (windows): .\venv\Scripts\activate (mac): source venv/bin/activate
    • Install all necessary packages: pip install -r requirements.txt
  2. Create your own .venv with in the folder called uni-data

    • repeat the commands above
  3. Create your own .env file with in the folder called server. It should contain the following:

DB_USERNAME='root (or whatever you called your db user)'
DB_PASSWORD='the password of the user you created'
DB_SERVER='localhost'
DB_PORT='3306'
DB_NAME='exchangeDB'
  1. Create your own .env file with in the folder called uni-data.

    • It should contain the same information as above
  2. To create the database and populate it with information. Run the following command in a bash shell (You need to be in the root folder exchangelicious):

    • ./setup_database.sh

Run the backend

  • cd server
  • python server.py
  • In web browser, go to http://127.0.0.1:8080/

Run the frontend

  • cd client
  • npm install
  • In web browser, go to http://127.0.0.1:3000/

Useful venv commandos

https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html

⚠️ You need to be in the server-folder.

  • Create your own virtual environment (venv): python -m venv .venv

  • Activate the venv (windows): .\venv\Scripts\activate (mac): source venv/bin/activate

  • Install all necessary packages: pip install -r requirements.txt

  • Update the requirements file (important when you install a package to the venv, that we all need):

    pip freeze > requirements.txt

  • Deactivate the venv: deactivate

How to download MySQL workbench

  1. Download and install the MySQL workbench

Github Codespaces setup

Start a codespace on a branch. Then do the following to setup the databse:

  • Run a MySQL Docker container with your choice of [CONTAINER_NAME] and [PASSWORD] for root user.

    docker run --name [CONTAINER_NAME] -p 3306:3306 -e MYSQL_ROOT_PASSWORD=[PASSWORD] -d mysql:latest

  • Look for "IPAddress" after running docker inspect [CONTAINER_NAME].

  • Check if the database is running docker run -it --rm mysql mysql -h [IP_ADDRESS] -u root -p.

  • Load SQL scripts to the database.

    docker exec -i [CONTAINER_NAME] mysql -h [IP_ADDRESS] -u root -p[PASSWORD] < ./server/database_schemas/countries.sql

    docker exec -i [CONTAINER_NAME] mysql -h [IP_ADDRESS] -u root -p[PASSWORD] < ./server/database_schemas/schema.sql

  • Run setup as local development.

About

Help exchange students find information easier

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •