Changeset - 05323a307d3e
[Not reviewed]
0 6 1
Ben Sturmfels (bsturmfels) - 8 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
 

	
 
FROM debian:stretch
 
# Default Stretch repositories are no longer available, so replacing with archive.
 
RUN echo "deb http://archive.debian.org/debian/ stretch main" > /etc/apt/sources.list
www/conservancy/apps/blog/models.py
Show inline comments
...
 
@@ -24,13 +24,13 @@ class Entry(models.Model, bsoup.SoupModelMixin):
 

	
 
    headline = models.CharField(max_length=200)
 
    slug = models.SlugField(unique_for_date='pub_date')
 
    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)
 
    date_last_modified = models.DateTimeField(auto_now=True)
 

	
 
    class Meta:
www/conservancy/apps/ccs_upload/urls.py
Show inline comments
 
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
...
 
@@ -36,14 +36,16 @@ class Event(models.Model):
 
    date_tentative = models.BooleanField(default=False)
 
    datetime = models.CharField("Date and Time", max_length=300, blank=True)
 
    slug = models.SlugField(unique_for_year='date')
 
    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)
 
    date_last_modified = models.DateTimeField(auto_now=True)
 

	
 
    class Meta:
...
 
@@ -68,13 +70,13 @@ class Event(models.Model):
 
class EventMedia(models.Model):
 
    """Media from an event
 

	
 
    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'),
 
                                       ('V', 'Video')))
 
    local = models.CharField(max_length=300, blank=True,
 
                             help_text="Local filename of the resource.  File should be uploaded into the static directory that corresponds to the event.")
www/conservancy/apps/news/models.py
Show inline comments
...
 
@@ -94,14 +94,14 @@ class ExternalArticle(models.Model):
 
    url = models.URLField(blank=True)
 
    date = models.DateField()
 
    visible = models.BooleanField(help_text="Whether to display on website", default=True)
 

	
 
    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)
 

	
 
    class Meta:
 
        ordering = ("-date_created",)
 
        get_latest_by = "date_created"
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
 

	
 
        * Performs redirects to strip trailing "index.html"
 
        * performs redirects based on APPEND_SLASH
0 comments (0 inline, 0 general)