13 lines
398 B
Python
13 lines
398 B
Python
|
|
import re
|
||
|
|
|
||
|
|
from django.core.exceptions import ImproperlyConfigured
|
||
|
|
|
||
|
|
|
||
|
|
def application_path(value):
|
||
|
|
"""A deployment-owned tenant path, never a value taken from request headers."""
|
||
|
|
if value in ('', '/'):
|
||
|
|
return ''
|
||
|
|
if not re.fullmatch(r'/[a-z0-9]+(?:-[a-z0-9]+)*', value):
|
||
|
|
raise ImproperlyConfigured('APP_BASE_PATH must be empty or /lowercase-tenant-slug')
|
||
|
|
return value
|