@@ -17,27 +17,32 @@ 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
29321 . Download and install [ pyenv] ( https://github.com/pyenv/pyenv )
33+ > You don't have to use ` pyenv ` but it makes life much easier when dealing with virtual environments.
30342 . Install [ PostgreSQL] ( https://www.postgresql.org/ ) for your system. This is required for Django
3135 - On Mac you can do ` brew install postgresql ` if you have brew installed.
32363 . 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.
37+ - On Mac you can do ` brew install libmagic ` if you have brew installed.
38+ > LibMagic is used for checking file types.
34394 . Checkout the repository
35405 . Switch to the repository directory
36416 . Setup Python
3742 - Install Python 3.12 ` pyenv install 3.12 ` or whatever the latest python is.
3843 - 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 `
44+ - Set the virtual environment for the directory ` pyenv local cncnet-map-api `
45+ 7 . Install the dev requirements ` pip install -r requirements-dev.txt `
4146 - On Apple Silicon you'll need to install lzo with ` brew install lzo ` then run
4247 ` CFLAGS=-I$(brew --prefix)/include LDFLAGS=-L$(brew --prefix)/lib pip install -r requirements-dev.txt `
4348 to get ` python-lzo ` to install. You shouldn't need to include those flags again unless ` python-lzo ` updates.
@@ -49,23 +54,37 @@ to debuggers and hitting breakpoints, so here are the native OS instructions.
4954 - If the app doesn't run due to a missing required variable, add said variable to ` example.env ` because the person
5055 who made the variable forgot to do so.
515610 . 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 ` )
57+ 11 . Load your ` .env ` file into your shell, (you can use ` source load_env.sh && read_env ` )< a name = " load-shell-env " ></ a >
5358then migrate the database ` ./manage.py migrate `
54- 12 . ` ./manage.py runserver `
59+ 12 . Run the django server with ` ./manage.py runserver `
60+
61+ Tests can be run by following [ these instructions] ( #running-tests-backend-devs )
62+
63+
64+ ### Windows
65+
66+ Chairman Bing of the Massivesoft corporation strikes again; getting the ` LZO ` libraries running
67+ natively on Windows is a... less-than-pleasant effort. So use docker instead.
68+
69+ 1 . Install docker for windows. I have had success with [ Rancher Desktop] ( https://rancherdesktop.io/ )
70+ or [ Docker Desktop] ( https://docs.docker.com/desktop/setup/install/windows-install/ )
71+ 2 . After docker is running, switch to your local git repo and run ` docker compose up windows-dev -d ` .
72+ Make sure the build succeeds.
73+ 3 . Set ` windows-dev ` as your python interpreter for whichever editor you use.
5574
56- You can technically use PyCharm to launch everything via ` docker-compose ` , but there is some
57- weird issue with breakpoints not triggering.
75+ > [ !TIP ]
76+ > In Pycharm you go to ` Settings > Project > Python Interpreter > Add Interpreter > Docker Compose `
5877
5978
60- ## Running tests
79+ ## Running tests (backend devs)
6180
62- I ** strongly** recommend using PyCharm and the ` .env ` plugin for running the PyTests.
81+ I strongly recommend using PyCharm (or any other Python IDE with breakpoints) and the ` .env ` plugin for running the PyTests.
6382All you need to do is run the database from ` docker-compose ` , then launch the tests via PyCharm.
6483
6584** If you want to run the tests via CLI:**
6685
6786- Make sure your database is running from the docker compose file. ` docker-compose start db `
68- - Make sure your environment variables are setup and loaded to your shell. See [ backend dev setup] ( #backend-devs )
87+ - Make sure your environment variables are setup and loaded to your shell. See [ backend dev setup] ( #load-shell-env )
6988- Run ` DJANGO_SETTINGS_MODULE="kirovy.settings.testing" pytest tests `
7089
7190Django should automatically run migrations as part of the test startup.
0 commit comments