Skip to content

tim-schilling/geodjango_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoDjango Debug Toolbar Test App

Minimal Django app for testing the Django Debug Toolbar with GeoDjango/PostGIS.

Prerequisites

System libraries:

# Ubuntu/Debian
sudo apt install libgdal-dev libgeos-dev libproj-dev

# macOS
brew install gdal geos proj

1. Start PostGIS

docker run -d --name postgis \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=geodjango \
  -p 5433:5432 \
  postgis/postgis:17-3.5

2. Install dependencies

uv sync

Installs Django, psycopg2-binary, and django-debug-toolbar from ../debug_toolbar/ (editable).

3. Migrate & run

uv run python manage.py migrate
uv run python manage.py runserver

Visit http://127.0.0.1:8000/. On first load, three locations are seeded and a spatial distance query runs:

SELECT ST_Distance("proj_location"."point", ST_GeomFromEWKB('\x...'::bytea)) AS "distance"
FROM "proj_location"
ORDER BY 1

The Django Debug Toolbar appears on the right side of the page — check the SQL panel to inspect the GeoDjango-generated queries.

Database config

Setting Value
Host localhost
Port 5433
Database geodjango
User postgres
Password postgres

Stop PostGIS

docker stop postgis && docker rm postgis

About

A test for geodjango with the django debug toolbar.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors