diff --git a/Dockerfile-debian-bullseye b/Dockerfile-debian-bullseye new file mode 100644 index 00000000..6651ce7a --- /dev/null +++ b/Dockerfile-debian-bullseye @@ -0,0 +1,12 @@ +# docker build --tag sfconservancy.org-bullseye - < Dockerfile-debian-bullseye +# docker run --tty --interactive --rm=true --publish=8000:8000 --mount type=bind,source=$(pwd),target=/var/www/website --mount type=bind,source=$(pwd)/conservancy-website.sqlite3,target=/var/lib/www/database/conservancy-website.sqlite3 sfconservancy.org-bullseye:latest + +ARG DEBIAN_FRONTEND=noninteractive + +FROM debian:bullseye +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -y python3 python3-pip python3-wheel sqlite3 +RUN apt-get install -y python3-django python3-bs4 python3-django-countries +RUN python3 -m pip freeze +WORKDIR /var/www/website/www +ENTRYPOINT ["python3", "/var/www/website/www/manage.py", "runserver", "0.0.0.0:8000"] diff --git a/Dockerfile-debian-stretch b/Dockerfile-debian-stretch index c9ef5f0d..91ad9120 100644 --- a/Dockerfile-debian-stretch +++ b/Dockerfile-debian-stretch @@ -1,5 +1,5 @@ -# docker build --tag sfconservancy.org - < Dockerfile-debian-stretch -# docker run --tty --interactive --rm=true --publish=8000:8000 --mount type=bind,source=$(pwd),target=/var/www/website --mount type=bind,source=$(pwd)/conservancy-website.sqlite3,target=/var/lib/www/database/conservancy-website.sqlite3 sfconservancy.org:latest +# docker build --tag sfconservancy.org-stretch - < Dockerfile-debian-stretch +# docker run --tty --interactive --rm=true --publish=8000:8000 --mount type=bind,source=$(pwd),target=/var/www/website --mount type=bind,source=$(pwd)/conservancy-website.sqlite3,target=/var/lib/www/database/conservancy-website.sqlite3 sfconservancy.org-stretch:latest ARG DEBIAN_FRONTEND=noninteractive diff --git a/www/conservancy/apps/blog/models.py b/www/conservancy/apps/blog/models.py index 330f6947..01b3be0c 100644 --- a/www/conservancy/apps/blog/models.py +++ b/www/conservancy/apps/blog/models.py @@ -27,7 +27,7 @@ class Entry(models.Model, bsoup.SoupModelMixin): summary = models.TextField(help_text="Use raw HTML. Unlike in the press release model, this summary is not included at the beginning of the body when the entry is displayed.") body = models.TextField(help_text="Use raw HTML. Include the full body of the post.") pub_date = models.DateTimeField() - author = models.ForeignKey(Person) + author = models.ForeignKey(Person, on_delete=models.PROTECT) tags = models.ManyToManyField(EntryTag, blank=True) date_created = models.DateTimeField(auto_now_add=True) diff --git a/www/conservancy/apps/ccs_upload/urls.py b/www/conservancy/apps/ccs_upload/urls.py index 66ee72b6..465cf355 100644 --- a/www/conservancy/apps/ccs_upload/urls.py +++ b/www/conservancy/apps/ccs_upload/urls.py @@ -2,6 +2,7 @@ from django.conf.urls import url from . import views +app_name = "ccs_upload" urlpatterns = [ url(r'^$', views.upload, name='form') ] diff --git a/www/conservancy/apps/events/models.py b/www/conservancy/apps/events/models.py index d34e241c..1b116820 100644 --- a/www/conservancy/apps/events/models.py +++ b/www/conservancy/apps/events/models.py @@ -39,8 +39,10 @@ class Event(models.Model): description = models.TextField(blank=True) people = models.ManyToManyField(Person, blank=True) location = models.CharField(max_length=1000) - earth_location = models.ForeignKey(EarthLocation, null=True, blank=True, - help_text="Label will not be displayed") + earth_location = models.ForeignKey( + EarthLocation, null=True, blank=True, help_text="Label will not be displayed", + on_delete=models.CASCADE + ) tags = models.ManyToManyField(EventTag, blank=True) date_created = models.DateTimeField(auto_now_add=True) @@ -71,7 +73,7 @@ class EventMedia(models.Model): includes transcripts, audio, and video pieces """ - event = models.ForeignKey(Event) + event = models.ForeignKey(Event, on_delete=models.CASCADE) format = models.CharField(max_length=1, choices=(('T', 'Transcript'), ('A', 'Audio'), diff --git a/www/conservancy/apps/news/models.py b/www/conservancy/apps/news/models.py index 64d31d63..f4031b14 100644 --- a/www/conservancy/apps/news/models.py +++ b/www/conservancy/apps/news/models.py @@ -97,8 +97,8 @@ class ExternalArticle(models.Model): tags = models.ManyToManyField(ExternalArticleTag, blank=True) people = models.ManyToManyField(Person, blank=True) - event = models.ForeignKey(Event, null=True, blank=True) - press_release = models.ForeignKey(PressRelease, null=True, blank=True) + event = models.ForeignKey(Event, null=True, blank=True, on_delete=models.CASCADE) + press_release = models.ForeignKey(PressRelease, null=True, blank=True, on_delete=models.CASCADE) date_created = models.DateField(auto_now_add=True) diff --git a/www/conservancy/middleware.py b/www/conservancy/middleware.py index 4aea2acb..17f95283 100644 --- a/www/conservancy/middleware.py +++ b/www/conservancy/middleware.py @@ -1,8 +1,11 @@ from django import http from django.conf import settings from django.utils.cache import patch_response_headers +from django.utils.deprecation import MiddlewareMixin -class ForceCanonicalHostnameMiddleware: + +class ForceCanonicalHostnameMiddleware(MiddlewareMixin): + # MiddlewareMixin provides compatiiblity for Django 1.10 style middleware. def process_request(self, request): """Modified common middleware for Conservancy site