Skip to content

Commit

Permalink
docs: update docs, use github contributing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Dec 12, 2023
1 parent eafd54b commit af8d5dc
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 14 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions docs/Contributing/0000-prerequisites.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
- [pre-commit](https://pre-commit.com/#install) _(optional, recommended)_
- [asdf](https://asdf-vm.com/#/core-manage-asdf-vm) or [rtx](https://github.com/jdx/rtx) _(optional, recommended)_
- You can install and manage versions of Python, Node, PDM, etc. with these tools.


97 changes: 83 additions & 14 deletions docs/Contributing/0001-setup-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,105 @@

The following documentation assume your system meet the [prerequisites](0000-prerequisites.md).

## Set your .env (part 1)
## Clone the repository

```shell
git clone [email protected]:ManoManoTech/firefighter-incident.git
cd firefighter-incident
```

## Load ASDF/RTX/Direnv _(optional)_

If you use ASDF, RTX or Direnv, you can load the environment with:

```shell
asdf install
# or
rtx install
direnv allow
```

## Install dependencies with PDM

> We assume you have `pdm` in your path. If you have installed it with `pipx`, you can use `pipx run pdm` instead.
```shell
pdm install
```

A new virtualenv will be created in `.venv` and dependencies will be installed.

## Activate your venv

While you can use `pdm run` to run commands, you can also activate your venv with:

```shell
source .venv/bin/activate
```

## Install pre-commit hooks _(optional)_

```shell
pre-commit install
```

## Set your .env

First, **copy** the `.env.example` to `.env` and edit it.

The first part of the `.env` is just your choice of local development, and dependencies connection details.

Make sure the following environment variables are set in the `.env` file:
Make sure to set the `SECRET_KEY` to a random string.

```bash title=".env (sample)"
TOOLS_COMMON_PGDB_HOST=localhost
INFRA_FIREFIGHTER_V2_CACHE_HOST=localhost
You can already fill `DJANGO_SUPERUSER_EMAIL`, `DJANGO_SUPERUSER_USERNAME` and `DJANGO_SUPERUSER_PASSWORD` to create a superuser.

## Setup everything

The following steps can be run with:
```shell
pdm run dev-env-setup
```

## Local development setup
It will performan the following steps:

### Install PDM
### 1. Launch dependencies with Docker

!!! note "TLDR"

- If you have [pipx](https://pypa.github.io/pipx/installation/) installed, you can use it to install PDM: `pipx install pdm`
- If you don't, install pipx then PDM `pip install --user pipx && pipx install pdm`
```shell
docker-compose up -d db redis
```

> Consider using ASDF or RTX instead.
### 2. Migrate the database

## Launch dependencies
```shell
pdm run migrate
```

If you only want the Redis and Postgres run with Docker
### 3. Load fixtures

```shell
docker-compose up -d db redis
pdm run loaddata
```

### 4. Create a superuser

```shell
pdm run createsuperuser
```

### 5. Collect static files

```shell
pdm run collectstatic
```

## You should now be able to run the server

```shell
pdm runserver
```

You can login at http://127.0.0.1:8000/admin/ with the superuser you created.


> If you run the server at this stage, you can expect some warnings/errors.

0 comments on commit af8d5dc

Please sign in to comment.