i'm trying to run django-cms on two different domains. For that i created two domains (django.contrib.sites) and added to them django-cms pages. Now i created a SiteDetectionMiddleware:
class SiteDetectionMiddleware:
def process_request(self, request):
settings.SITE_ID = 1
host = request.META.get('HTTP_HOST')
if host:
try:
site = Site.objects.get(domain=host)
settings.SITE_ID = site.id
except Site.DoesNotExist:
pass
It seems to work correctly, when i call the website in browser for the first time after restarting apache. Then i changed to the other site and got a NoReverseMatch Error.
Does anyone have an idea what could be wrong?
I thought this should work out of the box in django-cms?
regards Colin