January 6, 2011 | In: Django, Programming, Server configuration
django-cms settings missing when hosting on apache mod-wsgi
I spent some time trying to solve the problem with django-cms installation on our test server (wsgi configuration).
After succesfull installation of django-cms I received error saying when I had tried to visit my page:
AttributeError: ‘Settings’ object has no attribute ‘CMS_PERMISSION’
After some investigation I found that django-cms has it’s own mechanism to load required settings (can be found in /cms/conf/__init__.py) which wasn’t applied for my project and this was reason why CMS_PERMISSION setting was not visible in my app.
Solution that solved the problem was to call patch_settings() manually, before initialising wsgi handler. Modified django.wsgi should looks more or less like this:
import os
import sys
from cms.conf import patch_settings
os.path.append('path/to/project/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'MyProject.settings'
patch_settings()
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
My django-cms version is 2.1.0 rc1
I’m not sure if this is proper way for solving this probem but I couldn’t find any other solution for this issue.