- Node.js
- Python 3
- PostgreSQL
- PyEnv (optional but recommended)
`sudo apt-get install postgresql`
- Configure a password for the default
postgresuser: - Open a psql shell with the postgres user with:
sudo -u postgres psql. - At the
postgres=#prompt, type\passwordto set the password for the defaultpostgresuser. - Follow the prompts and enter the new password. Save it for the
.miaenvconfig file. - Create two databases
mia_appandtest_dbin psql with:CREATE DATABASE mia_app ;CREATE DATABASE test_db ;- Don't forget the
;after each SQL statement.
- [Optional] If ufw (uncomplicated firewall) is enabled and running, allow ports 80 and 443 for the web server with:
sudo ufw allow 80/tcpsudo ufw allow 443/tcp
`brew install postgresql`
-
Connect and create the DB:
psql postgres CREATE DATABASE mia_app; \q
-
For HTTPS access:
git clone https://github.com/UCI-ICTS/mia/ -
For SSH access*(RECCOMENDED)*:
git@github.com:UCI-ICTS/mia.git
Then
cd mia/
If you need to use a branch other than dev(the main branch):
git switch <BRANCH NAME> (for whatever branch you need)
Open a new terminal and retrun to the project root
cd PATH/TO/PROJECT/mia
For Mac/Linux: pyenv(optional)
cd server
pyenv local 3.11.1
python3 -m venv env
source env/bin/activate
pip3.9 install -r requirements.txt
cd server
python -m venv env
source env/Scripts/activate
pip install -r requirements.txt
-
Copy the
.secrets.exampleto.secretscp .secrets.example .secrets -
The
.secrets.exampleis set up to run on a local deployment with out modifications. If you want to update the.secretsfile the required keys are described here: secrets.md
[DJANGO_KEYS]
SECRET_KEY=my_secrete_key
[SERVER]
DEBUG=True
ALLOWED_HOSTS=*
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
SERVER_VERSION=BETA
DASHBOARD_URL=http://localhost:3000/
DATABASE=db.sqlite
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
[DATABASE]
ENGINE=django.db.backends.postgresql
NAME=mia_app_local
USER=postgres
PASSWORD=postgres
HOST=localhost
PORT=5432
[STATIC]
STATIC_URL=/PATH/TO/PROJECT/mia/server/static/
STATIC_ROOT=static
MEDIA_URL=/PATH/TO/PROJECT/mia/server/media/
MEDIA_ROOT=media
Create a DB:
python3 manage.py migrate
Load the DB with test data:
python manage.py loaddata config/fixtures/local_data.json
python3 manage.py runserver
Make sure API is accessible via web browser.
If it worked you should be able to see the API Documentation site at:
http://localhost:8000/mia/swagger/
and the Admin site at:
http://localhost:8000/mia/django-admin/
Use the following credentials to log in:
username: wheel@wheel.sh
password: wheel
cd mia/client/
Install Node packages via Node Package Manager (NPM)
npm install
cp .env.example .env
The values for local dev should be:
REACT_APP_BASEURL=http://localhost:3000/
REACT_APP_KBIDB=http://localhost:8000/
npm run start
This will open http://localhost:3000/ in your default webbrowser if everything went according to plan. If not, see the troubleshooting tips.
This terminal will be serving the React frontend.