diff --git a/src/pretalx/common/context_processors.py b/src/pretalx/common/context_processors.py
index fdf1dba1b..4f71a6f50 100644
--- a/src/pretalx/common/context_processors.py
+++ b/src/pretalx/common/context_processors.py
@@ -85,6 +85,7 @@ def system_information(request):
context["warning_update_available"] = False
context["warning_update_check_active"] = False
+ context["base_path"] = settings.BASE_PATH
if (
not request.user.is_anonymous
and request.user.is_administrator
diff --git a/src/pretalx/common/middleware/domains.py b/src/pretalx/common/middleware/domains.py
index d914452f2..78da44b7d 100644
--- a/src/pretalx/common/middleware/domains.py
+++ b/src/pretalx/common/middleware/domains.py
@@ -51,8 +51,10 @@ def process_request(self, request):
request.port = int(port) if port else None
request.uses_custom_domain = False
- resolved = resolve(request.path)
- if resolved.url_name in ANY_DOMAIN_ALLOWED or request.path.startswith("/api/"):
+ resolved = resolve(request.path_info)
+ if resolved.url_name in ANY_DOMAIN_ALLOWED or request.path_info.startswith(
+ "/api/"
+ ):
return None
event_slug = resolved.kwargs.get("event")
if event_slug:
@@ -76,7 +78,7 @@ def process_request(self, request):
if settings.DEBUG or domain in LOCAL_HOST_NAMES:
return None
- if request.path.startswith("/orga"): # pragma: no cover
+ if request.path_info.startswith("/orga"): # pragma: no cover
if default_port not in (80, 443):
default_domain = f"{default_domain}:{default_port}"
return redirect(urljoin(default_domain, request.get_full_path()))
diff --git a/src/pretalx/event/models/event.py b/src/pretalx/event/models/event.py
index e8a27b3fc..29e352557 100644
--- a/src/pretalx/event/models/event.py
+++ b/src/pretalx/event/models/event.py
@@ -321,7 +321,8 @@ class Event(PretalxModel):
objects = models.Manager()
class urls(EventUrls):
- base = "/{self.slug}/"
+ base_path = settings.BASE_PATH
+ base = "{base_path}/{self.slug}/"
login = "{base}login/"
logout = "{base}logout"
auth = "{base}auth/"
@@ -349,8 +350,9 @@ class urls(EventUrls):
schedule_widget_script = "{base}widgets/schedule.js"
class orga_urls(EventUrls):
- create = "/orga/event/new"
- base = "/orga/event/{self.slug}/"
+ base_path = settings.BASE_PATH
+ create = "{base_path}/orga/event/new"
+ base = "{base_path}/orga/event/{self.slug}/"
login = "{base}login/"
live = "{base}live"
delete = "{base}delete"
@@ -402,7 +404,8 @@ class orga_urls(EventUrls):
new_information = "{base}info/new"
class api_urls(EventUrls):
- base = "/api/events/{self.slug}/"
+ base_path = settings.BASE_PATH
+ base = "{base_path}/api/events/{self.slug}/"
submissions = "{base}submissions/"
talks = "{base}talks/"
schedules = "{base}schedules/"
diff --git a/src/pretalx/event/models/organiser.py b/src/pretalx/event/models/organiser.py
index 796323bfb..80ab2a737 100644
--- a/src/pretalx/event/models/organiser.py
+++ b/src/pretalx/event/models/organiser.py
@@ -1,6 +1,7 @@
import json
import string
+from django.conf import settings
from django.core.validators import RegexValidator
from django.db import models, transaction
from django.utils.crypto import get_random_string
@@ -48,7 +49,8 @@ def __str__(self) -> str:
return str(self.name)
class orga_urls(EventUrls):
- base = "/orga/organiser/{self.slug}/"
+ base_path = settings.BASE_PATH
+ base = "{base_path}/orga/organiser/{self.slug}/"
delete = "{base}delete"
teams = "{base}teams/"
new_team = "{teams}new"
diff --git a/src/pretalx/orga/context_processors.py b/src/pretalx/orga/context_processors.py
index 4514b456b..afb7e4cae 100644
--- a/src/pretalx/orga/context_processors.py
+++ b/src/pretalx/orga/context_processors.py
@@ -25,6 +25,7 @@ def orga_events(request):
# rather than using the settings object directly in the template
site_config = dict(settings.CONFIG.items("site"))
context["site_config"] = site_config
+ context["base_path"] = settings.BASE_PATH
if not request.path.startswith("/orga/"):
return {}
diff --git a/src/pretalx/orga/templates/orga/admin.html b/src/pretalx/orga/templates/orga/admin.html
index 4d970619c..ea431ce03 100644
--- a/src/pretalx/orga/templates/orga/admin.html
+++ b/src/pretalx/orga/templates/orga/admin.html
@@ -27,8 +27,9 @@
{% translate "Administrator information" %}
{% translate "Your pretalx version is:" %} {{ pretalx_version|copyable }}.
- {% blocktranslate trimmed with url="/orga/admin/update/" %}
- You can check for updates here.
+ {% url 'orga:admin.update' as update_url %}
+ {% blocktranslate trimmed %}
+ You can check for updates here.
{% endblocktranslate %}
@@ -97,17 +98,4 @@ Celery
{% endif %}
- {% translate "Links" %}
-
{% endblock %}
diff --git a/src/pretalx/orga/templates/orga/base.html b/src/pretalx/orga/templates/orga/base.html
index 3b64ab6c2..f597d0316 100644
--- a/src/pretalx/orga/templates/orga/base.html
+++ b/src/pretalx/orga/templates/orga/base.html
@@ -53,7 +53,7 @@
-
+
{{ site_config.name }}
@@ -392,20 +392,20 @@
{% endif %}
{% else %} {# if request.event #}
{% if request.orga_events|length > 1 %}
-
+
{% translate "Events" %}
{% endif %}
{% has_perm 'orga.view_organisers' request.user request as can_see_organisers %}
{% if can_see_organisers %}
-
+
{% translate "Organisers" %}
{% endif %}
{% if request.user.is_administrator %}
-
+
{% translate "Admin information" %}
diff --git a/src/pretalx/orga/urls.py b/src/pretalx/orga/urls.py
index 96c571c64..6ae9c2cf2 100644
--- a/src/pretalx/orga/urls.py
+++ b/src/pretalx/orga/urls.py
@@ -25,7 +25,7 @@
path("logout/", auth.logout_view, name="logout"),
path("reset/", auth.ResetView.as_view(), name="auth.reset"),
path("reset/
", auth.RecoverView.as_view(), name="auth.recover"),
- path("", RedirectView.as_view(url="event", permanent=False)),
+ path("", RedirectView.as_view(url="event", permanent=False), name="base"),
path("admin/", admin.AdminDashboard.as_view(), name="admin.dashboard"),
path("admin/update/", admin.UpdateCheckView.as_view(), name="admin.update"),
path("me", event.UserSettings.as_view(), name="user.view"),
diff --git a/src/pretalx/orga/views/admin.py b/src/pretalx/orga/views/admin.py
index d36d387f6..b27a8d678 100644
--- a/src/pretalx/orga/views/admin.py
+++ b/src/pretalx/orga/views/admin.py
@@ -28,6 +28,7 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
site_name = dict(settings.CONFIG.items("site")).get("name")
context["site_name"] = site_name
+ context["base_path"] = settings.BASE_PATH
return context
@context
diff --git a/src/pretalx/orga/views/event.py b/src/pretalx/orga/views/event.py
index 8d99f4af8..10c26a260 100644
--- a/src/pretalx/orga/views/event.py
+++ b/src/pretalx/orga/views/event.py
@@ -479,7 +479,7 @@ def password_reset_link(self):
def post(self, *args, **kwargs):
if not self.request.user.is_anonymous:
self.accept_invite(self.request.user)
- return redirect("/orga/event/")
+ return redirect(settings.BASE_PATH + "/orga/event/")
return super().post(*args, **kwargs)
def form_valid(self, form):
@@ -496,7 +496,7 @@ def form_valid(self, form):
self.accept_invite(user)
login(self.request, user, backend="django.contrib.auth.backends.ModelBackend")
- return redirect("/orga/event/")
+ return redirect(settings.BASE_PATH + "/orga/event/")
@transaction.atomic()
def accept_invite(self, user):
@@ -735,7 +735,7 @@ def action_back_url(self):
def post(self, request, *args, **kwargs):
self.get_object().shred(person=self.request.user)
- return redirect("/orga/")
+ return redirect(settings.BASE_PATH + "/orga/")
@method_decorator(csp_update(SCRIPT_SRC="'self' 'unsafe-eval'"), name="dispatch")
diff --git a/src/pretalx/orga/views/organiser.py b/src/pretalx/orga/views/organiser.py
index 7e4692baa..bf24f5ef0 100644
--- a/src/pretalx/orga/views/organiser.py
+++ b/src/pretalx/orga/views/organiser.py
@@ -1,6 +1,7 @@
import logging
from allauth.socialaccount.models import SocialApp
+from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect
@@ -359,4 +360,5 @@ def action_back_url(self):
def post(self, *args, **kwargs):
organiser = self.get_object()
organiser.shred()
- return HttpResponseRedirect("/orga/")
+ base_path = settings.BASE_PATH
+ return HttpResponseRedirect(base_path + "/orga/")
diff --git a/src/pretalx/orga/views/typeahead.py b/src/pretalx/orga/views/typeahead.py
index 2640a570f..d48aa2e82 100644
--- a/src/pretalx/orga/views/typeahead.py
+++ b/src/pretalx/orga/views/typeahead.py
@@ -1,6 +1,7 @@
import json
from contextlib import suppress
+from django.conf import settings
from django.db.models import Exists, OuterRef, Q
from django.http import JsonResponse
from django.utils.translation import ngettext_lazy as _n
@@ -12,10 +13,11 @@
def serialize_user(user):
+ base_path = settings.BASE_PATH
return {
"type": "user",
"name": str(user),
- "url": "/orga/me",
+ "url": base_path + "/orga/me",
}
diff --git a/src/pretalx/settings.py b/src/pretalx/settings.py
index a8836c1f3..d14b2cb26 100644
--- a/src/pretalx/settings.py
+++ b/src/pretalx/settings.py
@@ -125,10 +125,11 @@
ALLOWED_HOSTS = [
"*"
] # We have our own security middleware to allow for custom event URLs
-
ROOT_URLCONF = "pretalx.urls"
-STATIC_URL = config.get("site", "static")
-MEDIA_URL = config.get("site", "media")
+BASE_PATH = config.get("site", "base_path", fallback="")
+FORCE_SCRIPT_NAME = BASE_PATH
+STATIC_URL = config.get("site", "static", fallback=BASE_PATH + "/static/")
+MEDIA_URL = config.get("site", "media", fallback=BASE_PATH + "/media/")
FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
FILE_UPLOAD_DEFAULT_LIMIT = 10 * 1024 * 1024
IMAGE_DEFAULT_MAX_WIDTH = 1920
@@ -493,7 +494,7 @@ def merge_csp(*options, config=None):
## AUTHENTICATION SETTINGS
AUTH_USER_MODEL = "person.User"
-LOGIN_URL = "/orga/login"
+LOGIN_URL = BASE_PATH + "/orga/login"
AUTHENTICATION_BACKENDS = (
"rules.permissions.ObjectPermissionBackend",
"django.contrib.auth.backends.ModelBackend",
@@ -688,7 +689,7 @@ def merge_csp(*options, config=None):
# Below is configuration for SSO using eventyay-ticket
EVENTYAY_TICKET_BASE_PATH = config.get(
- "urls", "eventyay-ticket", fallback="https://tickets-dev.eventyay.com"
+ "urls", "eventyay-ticket", fallback="https://app-test.eventyay.com/tickets"
)
SITE_ID = 1
@@ -697,7 +698,7 @@ def merge_csp(*options, config=None):
# will take name from eventyay-ticket as username
ACCOUNT_USER_MODEL_USERNAME_FIELD = "name"
# redirect to home page after login with eventyay-ticket
-LOGIN_REDIRECT_URL = "/"
+LOGIN_REDIRECT_URL = BASE_PATH
# custom form for signup and adapter
SOCIALACCOUNT_FORMS = {"signup": "pretalx.sso_provider.forms.CustomSignUpForm"}
SOCIALACCOUNT_ADAPTER = "pretalx.sso_provider.views.CustomSocialAccountAdapter"