Changeset - 05323a307d3e
[Not reviewed]
0 6 1
Ben Sturmfels (bsturmfels) - 7 months ago 2023-09-12 00:59:45
ben@sturm.com.au
Add support for Debian Bullseye

Added `on_delete` attributes, updated ForceCanonicalHostnameMiddleware for
compatibility and added Dockerfile for Bullseye.
7 files changed with 27 insertions and 9 deletions:
0 comments (0 inline, 0 general)
Dockerfile-debian-bullseye
Show inline comments
 
new file 100644
 
# 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"]
Dockerfile-debian-stretch
Show inline comments
 
# 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
 

	
www/conservancy/apps/blog/models.py
Show inline comments
...
 
@@ -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)
www/conservancy/apps/ccs_upload/urls.py
Show inline comments
...
 
@@ -2,6 +2,7 @@ from django.conf.urls import url
 

	
 
from . import views
 

	
 
app_name = "ccs_upload"
 
urlpatterns = [
 
    url(r'^$', views.upload, name='form')
 
]
www/conservancy/apps/events/models.py
Show inline comments
...
 
@@ -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'),
www/conservancy/apps/news/models.py
Show inline comments
...
 
@@ -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)
 

	
www/conservancy/middleware.py
Show inline comments
 
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
0 comments (0 inline, 0 general)