Merge branch 'main' into catch_exceptions_on_precess_email_loop

This commit is contained in:
Christopher Broderick 2023-10-24 14:10:37 +01:00 committed by GitHub
commit db3a176611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 32 deletions

View File

@ -89,6 +89,8 @@ An example `local_settings` configuration for utilizing AWS SES for email:
.. code-block:: python .. code-block:: python
from .settings import *
import os import os
DEFAULT_FROM_EMAIL = "support@bitswan.space" DEFAULT_FROM_EMAIL = "support@bitswan.space"
@ -105,4 +107,30 @@ To integrate `django-ses`, bindmount a file to `/opt/extra-dependencies.txt` con
django-ses django-ses
Ensure to update the `docker.env` file with your necessary secrets. Make sure you update the `docker.env` file with the necessary secrets.
S3 base attachment support
---------------------------
Working from the previous SES example we add the following to `local_settings`:
.. code-block:: python
AWS_S3_REGION_NAME = os.environ.get("AWS_S3_REGION_NAME", "eu-central-1")
AWS_STORAGE_BUCKET_NAME = os.environ.get("AWS_STORAGE_BUCKET_NAME", "bitswan-helpdesk-attachments")
AWS_QUERYSTRING_AUTH = os.environ.get("AWS_QUERYSTRING_AUTH", True)
AWS_QUERYSTRING_EXPIRE = os.environ.get(
"AWS_QUERYSTRING_EXPIRE", 60 * 60
)
AWS_DEFAULT_ACL = "private"
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
To integrate `django-ses`, bindmount a file to `/opt/extra-dependencies.txt` containing:
.. code-block:: text
django-storages
boto3

View File

@ -4,7 +4,8 @@ RUN apt-get update
RUN apt-get install -yqq \ RUN apt-get install -yqq \
postgresql-common \ postgresql-common \
postgresql-client \ postgresql-client \
cron cron \
git
COPY requirements.txt /opt/django-helpdesk/requirements.txt COPY requirements.txt /opt/django-helpdesk/requirements.txt
COPY standalone/extra-requirements.txt /opt/django-helpdesk/standalone/extra-requirements.txt COPY standalone/extra-requirements.txt /opt/django-helpdesk/standalone/extra-requirements.txt
RUN pip3 install -r /opt/django-helpdesk/requirements.txt RUN pip3 install -r /opt/django-helpdesk/requirements.txt

View File

@ -0,0 +1 @@
from .settings import *

View File

@ -0,0 +1,2 @@
local_urlpatterns = [
]

View File

@ -65,7 +65,7 @@ MIDDLEWARE = [
"whitenoise.middleware.WhiteNoiseMiddleware", "whitenoise.middleware.WhiteNoiseMiddleware",
] ]
ROOT_URLCONF = 'demo.demodesk.config.urls' ROOT_URLCONF = 'standalone.config.urls'
TEMPLATES = [ TEMPLATES = [
{ {
@ -229,8 +229,3 @@ MEDIA_ROOT = '/data/media'
# for Django 3.2+, set default for autofields: # for Django 3.2+, set default for autofields:
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
try:
from .local_settings import *
except ImportError:
pass

View File

@ -1,32 +1,12 @@
"""django-helpdesk demodesk URL Configuration from .local_urls import local_urlpatterns
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
# The following uses the static() helper function,
# which only works when in development mode (using DEBUG).
# For a real deployment, you'd have to properly configure a media server.
# For more information, see:
# https://docs.djangoproject.com/en/1.10/howto/static-files/
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('', include('helpdesk.urls', namespace='helpdesk')), path('', include('helpdesk.urls', namespace='helpdesk')),
path('api/auth/', include('rest_framework.urls', namespace='rest_framework')) path('api/auth/', include('rest_framework.urls', namespace='rest_framework'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + local_urlpatterns

View File

@ -12,6 +12,6 @@ from django.core.wsgi import get_wsgi_application
import os import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "standalone.config.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "standalone.config.local_settings")
application = get_wsgi_application() application = get_wsgi_application()

View File

@ -4,7 +4,7 @@ import sys
def main(): def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "standalone.config.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "standalone.config.local_settings")
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError: except ImportError: