File tree Expand file tree Collapse file tree 9 files changed +61
-19
lines changed
docker-entrypoint-initdb.d Expand file tree Collapse file tree 9 files changed +61
-19
lines changed Original file line number Diff line number Diff line change 1+ # Copied from .gitignore
2+ __pycache__
3+ data
4+ * .pyc
5+ * .db
6+ locale /* /LC_MESSAGES /django.mo
7+ * /locale /* /LC_MESSAGES /django.mo
8+ .sass-cache /
9+ .coverage
10+ .direnv
11+ .envrc
12+ djangoproject /cache
13+ djangoproject /static /css /* .map
14+ djangoproject /static /css /* .css
15+ # Additional ignores for Docker
16+ .git /
Original file line number Diff line number Diff line change @@ -25,10 +25,21 @@ jobs:
2525 - name : Checkout repository
2626 uses : actions/checkout@v4
2727
28- - name : Test docker image build (local development)
28+ - if : matrix.req_file != 'tests.txt'
29+ name : Test docker image build (${{ matrix.req_file }})
2930 uses : docker/build-push-action@v6
3031 with :
3132 context : .
3233 push : false
3334 build-args : |
3435 REQ_FILE=requirements/${{ matrix.req_file }}
36+
37+ - if : matrix.req_file == 'tests.txt'
38+ name : Set up Docker Compose
39+ uses : docker/setup-compose-action@v1
40+
41+ - if : matrix.req_file == 'tests.txt'
42+ name : Run the tests via Docker
43+ run : |
44+ docker compose build
45+ docker compose run --rm web make ci
Original file line number Diff line number Diff line change 3333
3434watch-scss :
3535 watchmedo shell-command --patterns=* .scss --recursive --command=" make compile-scss-debug" $(SCSS )
36+
37+ reset-local-db :
38+ python -m manage flush --no-input
39+ python -m manage loaddata dev_sites
40+ python -m manage loaddata doc_releases
41+ python -m manage loaddata dashboard_production_metrics
42+ python -m manage update_metrics
Original file line number Diff line number Diff line change @@ -343,12 +343,26 @@ Running Locally with Docker
343343
344344 docker compose up
345345
346- 3. View the site at http://localhost:8000/
347-
348- 4. Run the tests::
346+ 3. Run the tests::
349347
350348 docker compose run --rm web python -m manage test
351349
350+ 4. Load the sample / local dev data::
351+
352+ docker compose run --rm web make reset-local-db
353+
354+ If preferred, refer to the "Install and run locally from a virtual environment"
355+ for more granular management commands to load specific data sets.
356+
357+ 5. View the site at http://www.djangoproject.localhost:8000/
358+ or http://dashboard.djangoproject.localhost:8000/.
359+
360+ 6. For docs, download the documentation (takes awhile)::
361+
362+ docker compose exec -it web python -m manage update_docs
363+
364+ 7. View the docs at http://docs.djangoproject.localhost:8000/.
365+
352366Pre-commit checks
353367-----------------
354368
Original file line number Diff line number Diff line change 2424SECRET_KEY = os .environ .get ("SECRET_KEY" )
2525
2626ALLOWED_HOSTS = [".localhost" , "127.0.0.1" , "www.127.0.0.1" ]
27-
28- LOCALE_MIDDLEWARE_EXCLUDED_HOSTS = ["docs.djangoproject.localhost" ]
29-
30- # django-hosts settings
31- PARENT_HOST = "djangoproject.localhost:8000"
Original file line number Diff line number Diff line change @@ -43,4 +43,9 @@ services:
4343 timeout : 10s
4444 retries : 10
4545 volumes :
46- - ./initdb/tracdb.sql:/docker-entrypoint-initdb.d/tracdb.sql
46+ # Mount the Postgres initialization scripts
47+ - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
48+ # This file contains the initial Trac database schema, but needs
49+ # to be loaded into the database manually (via 02_trac_schema.sh)
50+ # since it applies to the trac database, not the main Django database.
51+ - ./tracdb/trac.sql:/trac.sql
File renamed without changes.
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ PGPASSWORD=secret psql --username=code.djangoproject --dbname=code.djangoproject < /trac.sql
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- python -m manage flush --no-input
4- PGPASSWORD=secret psql --host db --port 5432 --username=code.djangoproject --dbname=code.djangoproject < tracdb/trac.sql
53python -m manage migrate
64make compile-scss # must come before collectstatic
75python -m manage collectstatic --no-input --clear
8- python -m manage loaddata dev_sites
9- python -m manage loaddata doc_releases
10- # git config --global url."https://".insteadOf git://
11- # python -m manage update_docs
12- python -m manage loaddata dashboard_production_metrics
13- # python -m manage loaddata dashboard_example_data
14- python -m manage update_metrics
156
167exec " $@ "
You can’t perform that action at this time.
0 commit comments