Getting Started¶
Installation¶
Frontend¶
Node 16 is required to run this project. Assuming you have Node 16, install dependencies for all packages with Yarn:
yarn
API¶
With `pyenv`
It is recommended to install python using pyenv to easily switch between versions without depending on system installed python versions.
Without `pyenv`
Python 3.9 and Poetry are required. If you are running Ubuntu 20.04, ensure that Python 3.9 is installed by running:
sudo apt install python-3.9 python3.9-dev
Assuming you have set up Poetry, install API dependencies:
PORT=3000 yarn web
Afterwards, create your api/.env file using the provided api/.env.example file:
cp .env.example .env
Fill out your .env file according to your local environment configuration. Ensure that the database you specify in DATABASE_URL exists.
Generate a DJANGO_SECRET_KEY
import secrets
print(secrets.token_urlsafe())
# Sample Output: 1eE8JzMmpsS4Pz_GvbcDSl07T_QhDlqmb6_JhMz-lUI
Add Sample Output Value: 1eE8JzMmpsS4Pz_GvbcDSl07T_QhDlqmb6_JhMz-lUI and update DJANGO_SECRET_KEY
Run Migrations
Finally, run migrations:
cd carbonpath
poetry run python manage.py migrate
Redis
Redis is required to run this project. Update api/.env to point to your redis server. For example:
DJANGO_REDIS_URL=redis://127.0.0.1:6379/1
DOCS¶
Assuming you have set up Poetry, install API dependencies:
cd docs
poetry install
Running¶
Dev server for the web
You can run the web server this way:
PORT=3000 yarn web
Dev server for API You can run the dev server for the API this way:
cd api/carbonpath
poetry run python manage.py runserver 0.0.0.0:8000
Redis Server
redis-server
Celery
Assuming redis server is already running:
cd api/carbonpath
poetry run celery -A config.celery_app worker --loglevel=info --beat