-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update docs, use github contributing guide
- Loading branch information
Showing
3 changed files
with
85 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. |