Quality of life (#266)

Support gunicorn autoreload on DEBUG
Pass docker postgres port to host
Add some typing to posts.py
This commit is contained in:
Corry Haines 2022-12-26 09:42:02 -08:00 committed by GitHub
parent a590427160
commit 31187c99b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -5,11 +5,12 @@ from django.utils.decorators import method_decorator
from django.views.decorators.vary import vary_on_headers from django.views.decorators.vary import vary_on_headers
from django.views.generic import TemplateView, View from django.views.generic import TemplateView, View
from activities.models import PostInteraction, PostStates from activities.models import Post, PostInteraction, PostStates
from activities.services import PostService from activities.services import PostService
from core.decorators import cache_page_by_ap_json from core.decorators import cache_page_by_ap_json
from core.ld import canonicalise from core.ld import canonicalise
from users.decorators import identity_required from users.decorators import identity_required
from users.models import Identity
from users.shortcuts import by_handle_or_404 from users.shortcuts import by_handle_or_404
@ -21,6 +22,9 @@ class Individual(TemplateView):
template_name = "activities/post.html" template_name = "activities/post.html"
identity: Identity
post_obj: Post
def get(self, request, handle, post_id): def get(self, request, handle, post_id):
self.identity = by_handle_or_404(self.request, handle, local=False) self.identity = by_handle_or_404(self.request, handle, local=False)
if self.identity.blocked: if self.identity.blocked:

View file

@ -20,6 +20,7 @@ x-takahe-common:
TAKAHE_EMAIL_BACKEND: "console://console" TAKAHE_EMAIL_BACKEND: "console://console"
TAKAHE_MAIN_DOMAIN: "example.com" TAKAHE_MAIN_DOMAIN: "example.com"
TAKAHE_ENVIRONMENT: "development" TAKAHE_ENVIRONMENT: "development"
GUNICORN_EXTRA_CMD_ARGS: "--reload"
networks: networks:
- external_network - external_network
- internal_network - internal_network
@ -43,6 +44,8 @@ services:
POSTGRES_DB: takahe POSTGRES_DB: takahe
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: insecure_password POSTGRES_PASSWORD: insecure_password
ports:
- "5433:5432"
web: web:
<<: *takahe-common <<: *takahe-common

View file

@ -7,7 +7,7 @@ sed s/__CACHESIZE__/${CACHE_SIZE}/g /takahe/docker/nginx.conf > /takahe/docker/n
# Run nginx and gunicorn # Run nginx and gunicorn
nginx -c "/takahe/docker/nginx.rendered.conf" & nginx -c "/takahe/docker/nginx.rendered.conf" &
gunicorn takahe.wsgi:application -b 0.0.0.0:8001 & gunicorn takahe.wsgi:application -b 0.0.0.0:8001 $GUNICORN_EXTRA_CMD_ARGS &
# Wait for any process to exit # Wait for any process to exit
wait -n wait -n