Skip to content

Commit

Permalink
Merge pull request #826 from CodeForAfrica/chore/upgrade_django_4.2
Browse files Browse the repository at this point in the history
Upgrade to Django 4.2
  • Loading branch information
kilemensi authored Nov 26, 2024
2 parents d33e8de + d60fbb1 commit 5685623
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 71 deletions.
5 changes: 4 additions & 1 deletion .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
extends: default

rules:
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.brackets
brackets:
max-spaces-inside: 1
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.line_length
line-length:
max: 88 # profile=black
max: 88 # profile=black
# https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.document_start
document-start:
present: false
20 changes: 10 additions & 10 deletions 3rdparty/py/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
boto3==1.35.64
boto3==1.35.68
celery==5.4.0
dj-rest-auth==5.1.0
# Match dj-rest-auth[with_social]==5.1.0
dj-rest-auth==7.0.0
# Must match dj-rest-auth[with_social]==7.0.0
django-allauth>=0.56.0,<0.62.0
Django==3.2.23
django-cors-headers==4.5.0
Django==4.2.16
django-cors-headers==4.6.0
django-storages==1.14.4
djangorestframework==3.15.1
djangorestframework==3.15.2
djangorestframework-simplejwt==5.3.1
environs[django]==10.3.0
google-api-python-client==2.153.0
environs[django]==11.2.1
google-api-python-client==2.154.0
google-auth==2.36.0
google-auth-httplib2==0.2.0
google-auth-oauthlib==1.2.1
Expand All @@ -19,7 +19,7 @@ html2text==2024.2.26
lxml==5.3.0
redis==5.2.0
requests==2.32.3
sentry-sdk==2.18.0
sentry-sdk==2.19.0
tablib[xlsx]==3.7.0
trafilatura==1.12.2
tweepy==4.14.0
tweepy==4.13.0 # NOTE(kilemensi) >=4.14.0 introduces breaking changes!
111 changes: 56 additions & 55 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
services:
db:
image: postgres:13.4
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${PGUSER:-api}
- POSTGRES_PASSWORD=${PGPASSWORD:-api}
- POSTGRES_DB=${PGDATABASE:-api}
ports:
# Allow DB access from outside the container
- "54321:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U twoops_tracker"]
interval: 5s
timeout: 5s
retries: 5
db:
image: postgres:13.4
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${PGUSER:-api}
- POSTGRES_PASSWORD=${PGPASSWORD:-api}
- POSTGRES_DB=${PGDATABASE:-api}
ports:
# Allow DB access from outside the container
- "54321:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U twoops_tracker"]
interval: 5s
timeout: 5s
retries: 5

redis:
restart: always
image: redis:6.2
ports:
# Allow Redis access from outside the container
- "63791:6379"
redis:
restart: always
image: redis:6.2
ports:
# Allow Redis access from outside the container
- "63791:6379"

twoopstracker_app:
image: codeforafrica/twoopstracker:latest
depends_on:
- db
- redis
env_file:
- ./twoops_tracker/.env.template
volumes:
- app-media:/app/media
- app-staticfiles:/app/staticfiles
twoopstracker_app:
image: codeforafrica/twoopstracker:latest
platform: "linux/amd64"
depends_on:
- db
- redis
env_file:
- ./twoops_tracker/.env.template
volumes:
- app-media:/app/media
- app-staticfiles:/app/staticfiles

twoopstracker:
image: nginx:1.20
restart: unless-stopped
volumes:
- ./contrib/docker-compose/nginx:/etc/nginx/conf.d
- app-media:/var/www/media
- app-staticfiles:/var/www/static
ports:
- 8000:80
depends_on:
- twoopstracker_app
twoopstracker:
image: nginx:1.20
restart: unless-stopped
volumes:
- ./contrib/docker-compose/nginx:/etc/nginx/conf.d
- app-media:/var/www/media
- app-staticfiles:/var/www/static
ports:
- 8000:80
depends_on:
- twoopstracker_app

pesacheck_meedan_bridge:
image: codeforafrica/pesacheck_meedan_bridge:latest
command: ["tail", "-f", "/dev/null"]
volumes:
- pesacheck-data:/app/database
env_file:
- ./pesacheck_meedan_bridge/.env
pesacheck_meedan_bridge:
image: codeforafrica/pesacheck_meedan_bridge:latest
command: [ "tail", "-f", "/dev/null" ]
volumes:
- pesacheck-data:/app/database
env_file:
- ./pesacheck_meedan_bridge/.env

volumes:
app-media:
app-staticfiles:
db-data:
pesacheck-data:
app-media:
app-staticfiles:
db-data:
pesacheck-data:
25 changes: 22 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
[project]
name = "commons-api"
version = "0.0.0"
requires-python = ">= 3.11"
authors = [{ name = 'Code for Africa', email = '[email protected]' }]
readme = "README.md"
keywords = ["api", "commons", "civictech", "trolltracker"]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.11',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Framework :: Django',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
]

[project.urls]
Repository = "https://github.com/CodeForAfrica/api"
Issues = "https://github.com/CodeForAfrica/api/issues"

[tool.isort]
profile = "black"
Expand All @@ -8,8 +30,5 @@ profile = "black"
ignore_missing_imports = true
# TODO(kilemensi): mypy django stubs

[tool.ruff]
target-version = "py311" # default: py39

[tool.setuptools_scm]
write_to = "VERSION"
2 changes: 1 addition & 1 deletion twoops_tracker/py/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ pex_binary(
dependencies=[
":lib",
],
entry_point="main.py",
entry_point="twoops_tracker/py/twoopstracker/main",
)
1 change: 1 addition & 0 deletions twoops_tracker/py/twoopstracker/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"allauth.account.middleware.AccountMiddleware",
]

ROOT_URLCONF = "twoopstracker.urls"
Expand Down
2 changes: 1 addition & 1 deletion twoops_tracker/py/twoopstracker/twoops/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from twoopstracker.db.models import TimestampedModelMixin


Expand Down

0 comments on commit 5685623

Please sign in to comment.