diff --git a/nearbyshops/nearbyshops/settings.py b/nearbyshops/nearbyshops/settings.py index 666c931483..168af4d369 100644 --- a/nearbyshops/nearbyshops/settings.py +++ b/nearbyshops/nearbyshops/settings.py @@ -119,8 +119,6 @@ USE_I18N = True -USE_L10N = True - USE_TZ = True @@ -128,3 +126,5 @@ # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = "/static/" + +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" diff --git a/nearbyshops/readme.md b/nearbyshops/readme.md index 16da6aef89..2d146fbfd1 100644 --- a/nearbyshops/readme.md +++ b/nearbyshops/readme.md @@ -2,5 +2,24 @@ This folder contains the bonus material & example projects for our [Make a Location-Based Web App With Django and GeoDjango](https://realpython.com/location-based-app-with-geodjango-tutorial) tutorial on Real Python. -Check out [Make a Location-Based Web App With Django and GeoDjango](https://realpython.com/location-based-app-with-geodjango-tutorial/) for more information. +Check out [Make a Location-Based Web App With Django and GeoDjango](https://realpython.com/location-based-app-with-geodjango-tutorial/) for more information. +## Requirements + +- Python 3.12 or later +- GDAL, GEOS, and PROJ installed on your system +- A PostgreSQL database with the PostGIS extension, for example: + +```console +$ docker run --name=postgis -d -e POSTGRES_USER=user001 \ + -e POSTGRES_PASS=123456789 -e POSTGRES_DBNAME=gis \ + -p 5432:5432 kartoza/postgis:18-3.6 +``` + +Install the Python dependencies, then load the data and run the server: + +```console +$ python -m pip install -r requirements.txt +$ python manage.py migrate +$ python manage.py runserver +``` diff --git a/nearbyshops/requirements.txt b/nearbyshops/requirements.txt new file mode 100644 index 0000000000..638e84fac9 --- /dev/null +++ b/nearbyshops/requirements.txt @@ -0,0 +1,2 @@ +django==6.1.1 +psycopg2-binary==2.9.13 diff --git a/nearbyshops/shops/admin.py b/nearbyshops/shops/admin.py index 53666b29ad..a09d92239f 100644 --- a/nearbyshops/shops/admin.py +++ b/nearbyshops/shops/admin.py @@ -1,11 +1,11 @@ # Register your models here. from django.contrib import admin -from django.contrib.gis.admin import OSMGeoAdmin +from django.contrib.gis.admin import GISModelAdmin from .models import Shop @admin.register(Shop) -class ShopAdmin(OSMGeoAdmin): +class ShopAdmin(GISModelAdmin): list_display = ("name", "location")