The code for https://climateconnect.earth.
- Create a local Postgres database with your own username and password. You will connect to this for your local backend project.
- Create 32 char random secret key for your local setup. Run
openssl rand -base64 32
. Copy the value you will be using this to add as SECRET_KEY for django settings.
We are using Python/Django for backend and Next.js for frontend.
- Create a python virtual environment
python3 -m venv climateconnect_env
- Run following commands to start virtual environment
cd climateconnect_env source bin/activate
- Clone GitHub repository
git clone <URL>
Currently, we use docker to run Redis server locally.
If you do not have docker installed locally, follow the official steps: https://docs.docker.com/get-docker/
- Go to backend directory
cd backend
- Run
docker-compose up
. This will start Redis server on docker
Once you clone the repository start backend server.
- Go to backend directory
cd backend
- Run
pip install -r requirements.txt
to install all backend libararies. - Create
.backend_env
to include backend environment variables. You can find upto date sample env variables inbackend/local-env-setup.md
file. - Run
python manage.py migrate
to run django migrations. Note: This command is used for when you first start or whenever you are adding or updating database models. - Run server using
python manage.py runserver
. - If you want to run tests suite use this command:
python manage.py test
. If you want to run a specific test file or test class run this command:python manage.py test <file_path> or <file_path + class_name>
cd frontend
- Run
yarn install
to download all npm packages - Add
.env
file for frontend environment variables. You can find which env variables you have to set in/frontend/next.config.js/
- Run
yarn dev
to start developing
- Use GitHub actions to push to a server. A deploy file can be found in
.github/workflows
cd frontend
yarn --production
yarn build
node server.js
ORnext start
- Make sure your
ENVIRONMENT
env variable is set toproduction
- Follow steps 1-5 of the "Getting started locally - backend" (above in this file)