Skip to content

Commit

Permalink
lets fly with python 3.12 and django 5.1.3 and newer libs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrzej Kostanski authored and Andrzej Kostanski committed Nov 14, 2024
1 parent 757f397 commit 7a36e98
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 29 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6
FROM python:3.12

ENV PYTHONUNBUFFERED 1
ENV DJANGO_ENV dev
Expand Down
Binary file added api/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions api/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mapwidgets.widgets import GooglePointFieldWidget
from mapwidgets.widgets import GoogleMapPointFieldWidget

from django.contrib import admin
from django.contrib.gis.db import models
Expand All @@ -9,5 +9,5 @@
@admin.register(DjTinderUser)
class DjTinderUserAdmin(admin.ModelAdmin):
formfield_overrides = {
models.PointField: {"widget": GooglePointFieldWidget}
models.PointField: {"widget": GoogleMapPointFieldWidget}
}
Binary file added api/management/.DS_Store
Binary file not shown.
5 changes: 4 additions & 1 deletion django_tinder/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': os.environ.get('POSTGRES_DB_NAME'),
'NAME': os.environ.get('POSTGRES_DB'),
'USER': os.environ.get('POSTGRES_USER'),
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
'HOST': os.environ.get('POSTGRES_HOST'),
'PORT': 5432,
'TEST': {
'NAME': 'mytestdatabase',
},
}
}

Expand Down
6 changes: 3 additions & 3 deletions django_tinder/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf.urls import include, url
from django.urls import include, re_path
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^api/', include('api.urls')),
re_path(r'^admin/', admin.site.urls),
re_path(r'^api/', include('api.urls')),
]
36 changes: 23 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.6'
version: '3.12'


x-environment: &environment
Expand All @@ -8,19 +8,8 @@ x-environment: &environment
POSTGRES_HOST: db
GOOGLE_MAP_API_KEY: ${GOOGLE_MAP_API_KEY}


services:

db:
image: mdillon/postgis
container_name: db
environment:
<<: *environment
volumes:
- postgres_data:/var/lib/postgresql/data/
ports:
- 5432:5432

web:
build: .
container_name: web
Expand All @@ -32,7 +21,28 @@ services:
ports:
- 8000:8000
depends_on:
- db
db:
condition: service_healthy
restart: true

db:
platform: linux/amd64
image: postgis/postgis
container_name: db
environment:
<<: *environment
volumes:
- ./docker/db/custom_postgresql.conf:/etc/postgresql.conf
- ./docker/db/custom_pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf
- postgres_data:/var/lib/postgresql/data/
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
retries: 5
start_period: 30s
timeout: 10s

volumes:
postgres_data:
Binary file added docker/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions docker/db/custom_pg_hba.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
host all all all scram-sha-256

host demo postgres ::1/128 password
1 change: 1 addition & 0 deletions docker/db/custom_postgresql.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
listen_addresses = '*'
18 changes: 9 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Django==3.0.5
djangorestframework==3.11.0
psycopg2-binary==2.7.5
django-extensions==2.1.4
numpy==1.16.1
ipdb==0.11
django-map-widgets==0.3.0
pytest==5.2.0
pytest-django==3.4.7
Django==5.1.3
djangorestframework==3.15.2
psycopg2-binary==2.9.10
django-extensions==3.2.3
numpy==2.1.3
ipdb==0.13.13
django-map-widgets==0.5.1
pytest==8.3.3
pytest-django==4.9.0

0 comments on commit 7a36e98

Please sign in to comment.