- MySQL (docker is fine)
- python3 (venv usage is heavily encouraged)
- npm
VSCode is the recommended editor for this project.
please DO NOT use git through the command line. This will be painful for everyone
Backend only
Since custom package and specific package version are used in this project, we recommend using venv
for development so your local python env won't be polluted.
docker build -t reactapp -f Dockerfile .
docker-compose -f docker-compose.dev.yml up -d
This command will run a latest mysql w/ combination root/password
on 127.0.0.1:3306
and phpmyadmin on 127.0.0.1:8088
. You may use this web interface to manage the database.
docker-compose -f docker-compose.dev.yml down
And recreate using the first command.
linux:
sudo apt install mysql-server
If you install the server any other way and are prompted with a password, leave the field blank. If you set the password, you may not need to do the step below.
After running MySQL with admin priveges (sudo), run the following queries to reset the root password.
DROP USER 'root'@'%';
CREATE USER 'root'@'%' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
CREATE DATABASE mysqldb
You should always use venv! This will help us isolate the dependencies of our project to make for easier installation
Before you start the setup, make sure you are inside the 'backend/' directory. If not, make sure to add your venv directory to the gitignore file.
python3 -m venv venv
The above command will generate venv
under current directory
source venv/bin/activate
<venv>\Scripts\activate.bat
<venv>\Scripts\Activate.ps1
You should now see (venv)
in front of your command ine
deactivate
python3 -m pip install -r requirements.txt
before you runs this commmand, run which python3 (bash)
or where python3 (windows)
to make sure that you are installing to your venv!
After adding new dependency, run the following command to lock requirements.txt
pip freeze > requirements.txt
- migrate the latest model changes to the database by running the following commands
python manage.py makemigrations
python manage.py migrate
- If you run in to errors, either go in the docker shell or command line and run the following query to reset the database
DROP DATABASE surgey_generator_db; CREATE DATABASE surgey_generator_db;
cd ethicssite
python3 manage.py migrate
python3 manage.py createcachetable
and start server by
python3 manage.py runserver
Frontend only
Head to the root of the project and run the following:
npm install
cd src
npm run start