fix cookie stuff?
This commit is contained in:
@@ -42,6 +42,8 @@ DEBUG = True
|
|||||||
|
|
||||||
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '127.0.0.1,localhost').strip().replace(' ', '').split(',')
|
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '127.0.0.1,localhost').strip().replace(' ', '').split(',')
|
||||||
|
|
||||||
|
ADMIN_BASE_URL = os.environ.get('ADMIN_BASE_URL', '/admin/')
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
"""
|
"""
|
||||||
URL configuration for django_proxmox_mikrotik project.
|
URL configuration for django_proxmox_mikrotik project.
|
||||||
|
|
||||||
@@ -17,9 +18,10 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
from .settings import ADMIN_BASE_URL
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path(ADMIN_BASE_URL.strip('/') + '/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
||||||
# django_proxmox_mikrotik/urls.py
|
# django_proxmox_mikrotik/urls.py
|
||||||
@@ -28,4 +30,4 @@ urlpatterns += [
|
|||||||
path('frontend/', include('frontend.urls', namespace='frontend')),
|
path('frontend/', include('frontend.urls', namespace='frontend')),
|
||||||
path('manager/', include('manager.urls', namespace='manager')),
|
path('manager/', include('manager.urls', namespace='manager')),
|
||||||
path('tasklogger/', include('tasklogger.urls', namespace='tasklogger')),
|
path('tasklogger/', include('tasklogger.urls', namespace='tasklogger')),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
from django_proxmox_mikrotik.settings import ADMIN_BASE_URL
|
||||||
|
|
||||||
|
|
||||||
class FrontendSessionMiddleware:
|
class FrontendSessionMiddleware:
|
||||||
def __init__(self, get_response):
|
def __init__(self, get_response):
|
||||||
self.get_response = get_response
|
self.get_response = get_response
|
||||||
self.default_session_cookie_name = 'sessionid'
|
self.default_session_cookie_name = 'sessionid'
|
||||||
|
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
if request.path.startswith('/frontend/'):
|
if not request.path.startswith(ADMIN_BASE_URL):
|
||||||
settings.SESSION_COOKIE_NAME = settings.SESSION_COOKIE_NAME_FRONTEND
|
settings.SESSION_COOKIE_NAME = settings.SESSION_COOKIE_NAME_FRONTEND
|
||||||
else:
|
else:
|
||||||
settings.SESSION_COOKIE_NAME = self.default_session_cookie_name
|
settings.SESSION_COOKIE_NAME = self.default_session_cookie_name
|
||||||
|
|||||||
Reference in New Issue
Block a user