Savor the Flavor of Global Exchange!
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)
- You need to have Node.js installed on your computer: https://nodejs.org/en
- mysql
- And python of course
-
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
- Create your own virtual environment (venv):
-
Create your own .venv with in the folder called uni-data
- repeat the commands above
-
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'-
Create your own .env file with in the folder called uni-data.
- It should contain the same information as above
-
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
cd serverpython server.py- In web browser, go to
http://127.0.0.1:8080/
cd clientnpm install- In web browser, go to
http://127.0.0.1:3000/
https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html
-
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
-
Download and install the MySQL workbench
- Windows: https://dev.mysql.com/downloads/windows/installer/8.0.html
- mac: https://dev.mysql.com/downloads/workbench/
- I followed this youtube tutorial. However, this probably install more than we need
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.sqldocker exec -i [CONTAINER_NAME] mysql -h [IP_ADDRESS] -u root -p[PASSWORD] < ./server/database_schemas/schema.sql -
Run setup as local development.
