Skip to content

Commit 9ed3d17

Browse files
committed
- Improve readme to account for docker-compose changes and Windows.
1 parent 13074d0 commit 9ed3d17

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

README.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,34 @@ The mascot for the backend API is Kirovy, by [Direct & Dominate](https://www.you
1717

1818
## Frontend devs
1919

20-
Just set up your environment file and run the full docker compose.
20+
Just set up your environment file and run `docker compose up web -d`.
21+
22+
This will launch the database, run the migrations, and start the django web server.
2123

2224
[Example env file](example.env)
2325

2426
## Backend devs
2527

26-
You can use the docker files if you'd like, but Django + docker is known to have issue attaching
27-
to debuggers and hitting breakpoints, so here are the native OS instructions.
28+
You can use docker compose if you'd like, but here are the native OS instructions.
29+
30+
### Linux and Mac
2831

2932
1. Download and install [pyenv](https://github.com/pyenv/pyenv)
33+
> [!NOTE]
34+
> You don't have to use `pyenv` but it makes life much easier when dealing with virtual environments.
3035
2. Install [PostgreSQL](https://www.postgresql.org/) for your system. This is required for Django
3136
- On Mac you can do `brew install postgresql` if you have brew installed.
3237
3. Install LibMagic for [Python Magic](https://github.com/ahupp/python-magic)
33-
- On Mac you can do `brew install libmagic` if you have breq installed.
38+
- On Mac you can do `brew install libmagic` if you have brew installed.
39+
> [!NOTE]
40+
> LibMagic is used for checking file types.
3441
4. Checkout the repository
3542
5. Switch to the repository directory
3643
6. Setup Python
3744
- Install Python 3.12 `pyenv install 3.12` or whatever the latest python is.
3845
- Setup the virtual environments `pyenv virtualenv 3.12 cncnet-map-api`
39-
- Set the virtual enviornment for the directory `pyenv local cncnet-map-api`
40-
7. Setup requirements `pip install -r requirements-dev.txt`
46+
- Set the virtual environment for the directory `pyenv local cncnet-map-api`
47+
7. Install the dev requirements `pip install -r requirements-dev.txt`
4148
- On Apple Silicon you'll need to install lzo with `brew install lzo` then run
4249
`CFLAGS=-I$(brew --prefix)/include LDFLAGS=-L$(brew --prefix)/lib pip install -r requirements-dev.txt`
4350
to get `python-lzo` to install. You shouldn't need to include those flags again unless `python-lzo` updates.
@@ -49,33 +56,36 @@ to debuggers and hitting breakpoints, so here are the native OS instructions.
4956
- If the app doesn't run due to a missing required variable, add said variable to `example.env` because the person
5057
who made the variable forgot to do so.
5158
10. Run the `db` service in `docker-compose`
52-
11. Load your `.env` file into your shell, (you can use `source load_env.sh && read_env`)
59+
11. Load your `.env` file into your shell, (you can use `source load_env.sh && read_env`)<a name="load-shell-env"></a>
5360
then migrate the database `./manage.py migrate`
54-
12. `./manage.py runserver`
61+
12. Run the django server with `./manage.py runserver`
62+
63+
Tests can be run by following [these instructions](#running-tests-backend-devs)
5564

56-
You can technically use PyCharm to launch everything via `docker-compose`, but there is some
57-
weird issue with breakpoints not triggering.
5865

5966
### Windows
6067

61-
Chairman Bing of the Massivesoft corporation strikes again and getting the `LZO` libraries running
68+
Chairman Bing of the Massivesoft corporation strikes again; getting the `LZO` libraries running
6269
natively on Windows is a... less-than-pleasant effort. So use docker instead.
6370

64-
1. Install docker for windows. I have had success with "Rancher Desktop" or "Docker Desktop"
65-
2. After docker is configured, run `docker compose up windows-dev -d` and make sure the build succeeds.
71+
1. Install docker for windows. I have had success with [Rancher Desktop](https://rancherdesktop.io/)
72+
or [Docker Desktop](https://docs.docker.com/desktop/setup/install/windows-install/)
73+
2. After docker is running, switch to your local git repo and run `docker compose up windows-dev -d`.
74+
Make sure the build succeeds.
6675
3. Set `windows-dev` as your python interpreter for whichever editor you use.
67-
1. In Pycharm you go to `Seeting > Project > Python Interpreter > Add Interpreter > Docker Compose`
76+
> [!TIP]
77+
> In Pycharm you go to `Seeting > Project > Python Interpreter > Add Interpreter > Docker Compose`
6878
6979

70-
## Running tests
80+
## Running tests (backend devs)
7181

72-
I **strongly** recommend using PyCharm and the `.env` plugin for running the PyTests.
82+
I strongly recommend using PyCharm (or any other Python IDE with breakpoints) and the `.env` plugin for running the PyTests.
7383
All you need to do is run the database from `docker-compose`, then launch the tests via PyCharm.
7484

7585
**If you want to run the tests via CLI:**
7686

7787
- Make sure your database is running from the docker compose file. `docker-compose start db`
78-
- Make sure your environment variables are setup and loaded to your shell. See [backend dev setup](#backend-devs)
88+
- Make sure your environment variables are setup and loaded to your shell. See [backend dev setup](#load-shell-env)
7989
- Run `DJANGO_SETTINGS_MODULE="kirovy.settings.testing" pytest tests`
8090

8191
Django should automatically run migrations as part of the test startup.

0 commit comments

Comments
 (0)