Skip to content

Semantic web application in collaboration with IBM that extended MIT’s moral machine by allowing users to create and answer ethical questions with the utilization of machine learning microservices

Notifications You must be signed in to change notification settings

inwonakng/SurveyGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Survey Generator

Development setup

Requirements:

  • 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

Installation (backend only)

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.

Configure MySQL

Using Docker (recommended)

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.

Remove/Recreate Mysql

docker-compose -f docker-compose.dev.yml down

And recreate using the first command.

Manually installing and setting up MySQL

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.

Fixing privilege

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

venv

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

Enter Virtualenv

source venv/bin/activate
<venv>\Scripts\activate.bat
<venv>\Scripts\Activate.ps1

On windows, try to stick to powershell, which is the default vscode terminal.

You should now see (venv) in front of your command ine

Exit Virtualenv

deactivate

Dependencies

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!

Add new dependency

After adding new dependency, run the following command to lock requirements.txt

pip freeze > requirements.txt

Database setup (backend only)

After model changes (backend changes that need to be reflected in the database)

  • 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;

Migration & Start Server

cd ethicssite
python3 manage.py migrate
python3 manage.py createcachetable

and start server by

python3 manage.py runserver

Installation & Run (frontend only)

Frontend only

Head to the root of the project and run the following:

npm install
cd src
npm run start

About

Semantic web application in collaboration with IBM that extended MIT’s moral machine by allowing users to create and answer ethical questions with the utilization of machine learning microservices

Topics

Resources

Stars

Watchers

Forks