django_cms ImproperlyConfigured: Error importing middleware cms.middleware.media

旧城冷巷雨未停 提交于 2019-12-04 05:09:37

Thanks to my friend Bartosz Ptaszynski for pointing me in the right direction on this one. It was a path problem. Added this to the top of the settings.py file and it all magically started working.

sys.path.insert(0, '/path_to_app/app/')

And as he pointed out:

Exception occurred within WSGI script means that the path while running under the web server was wrong it's a completely different environment than the manage.py shell

I had the same problem. But since it only occurs when using mod_wsgi, another solution is adding the path in the apache config (rather than editing the syspath inside setting.py):

    # mod_wsgi settings
WSGIDaemonProcess name user=user group=group python-path=/app_path/app/:/app_path/lib/python2.6/site-packages/:/app_path/
WSGIProcessGroup polykum

Including the site packages in the path is also given in the example of Jon Black.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!