|
| 1 | +# Local Development |
| 2 | + |
| 3 | +This page covers working on Yamtrack from source. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3.12 |
| 8 | +- Docker |
| 9 | +- Redis |
| 10 | + |
| 11 | +## 1. Clone the repository |
| 12 | + |
| 13 | +```bash |
| 14 | +git clone https://github.com/FuzzyGrim/Yamtrack.git |
| 15 | +cd Yamtrack |
| 16 | +``` |
| 17 | + |
| 18 | +## 2. Start Redis |
| 19 | + |
| 20 | +If you do not already have Redis running locally, start it with Docker: |
| 21 | + |
| 22 | +```bash |
| 23 | +docker run -d --name redis -p 6379:6379 --restart unless-stopped redis:8-alpine |
| 24 | +``` |
| 25 | + |
| 26 | +## 3. Create a virtual environment |
| 27 | + |
| 28 | +```bash |
| 29 | +python -m venv venv |
| 30 | +venv/bin/python -m pip install -U -r requirements-dev.txt |
| 31 | +venv/bin/pre-commit install |
| 32 | +``` |
| 33 | + |
| 34 | +## 4. Configure environment values |
| 35 | + |
| 36 | +Create a `.env` file in the repository root: |
| 37 | + |
| 38 | +```bash |
| 39 | +TMDB_API=API_KEY |
| 40 | +MAL_API=API_KEY |
| 41 | +IGDB_ID=IGDB_ID |
| 42 | +IGDB_SECRET=IGDB_SECRET |
| 43 | +STEAM_API_KEY=STEAM_API_SECRET |
| 44 | +BGG_API_TOKEN=BGG_API_TOKEN |
| 45 | +SECRET=SECRET |
| 46 | +DEBUG=True |
| 47 | +``` |
| 48 | + |
| 49 | +See [Environment Variables](env-variables.md) for the full list of supported settings. |
| 50 | + |
| 51 | +## 5. Prepare the database |
| 52 | + |
| 53 | +```bash |
| 54 | +cd src |
| 55 | +../venv/bin/python manage.py migrate |
| 56 | +``` |
| 57 | + |
| 58 | +## 6. Run the app |
| 59 | + |
| 60 | +Run the Django development server: |
| 61 | + |
| 62 | +```bash |
| 63 | +cd src |
| 64 | +../venv/bin/python manage.py runserver |
| 65 | +``` |
| 66 | + |
| 67 | +Run the Celery worker with the scheduler in another terminal: |
| 68 | + |
| 69 | +```bash |
| 70 | +cd src |
| 71 | +../venv/bin/celery -A config worker --beat --scheduler django --loglevel DEBUG |
| 72 | +``` |
| 73 | + |
| 74 | +Run Tailwind in another terminal: |
| 75 | + |
| 76 | +```bash |
| 77 | +cd src |
| 78 | +../venv/bin/tailwindcss -i ./static/css/input.css -o ./static/css/tailwind.css --watch |
| 79 | +``` |
| 80 | + |
| 81 | +Open the development server at: |
| 82 | + |
| 83 | +```text |
| 84 | +http://localhost:8000 |
| 85 | +``` |
| 86 | + |
| 87 | +## Documentation |
| 88 | + |
| 89 | +Install the docs dependencies with the development requirements, then serve the current checkout: |
| 90 | + |
| 91 | +```bash |
| 92 | +venv/bin/mkdocs serve --livereload |
| 93 | +``` |
0 commit comments