How do I stop getting ImportError: Could not import settings 'mofin.settings' when using django with wsgi?

前端 未结 15 1997
渐次进展
渐次进展 2020-12-04 11:15

I can\'t get wsgi to import my settings file for my project \'mofin\'.

The list of errors from the apache error log are as follows

mod_wsgi (pid=4001         


        
15条回答
  •  天涯浪人
    2020-12-04 11:50

    I was going to say that you can just insert/append your project directory to your sys.path in your wsgi file but if your settings file is at

    /home/django/mofin/trunk/mofin/settings.py
    

    Then you should be good there.

    Is it on sys.path? Does it have syntax errors?
    

    That pretty much sums up what you are looking for.

    Interesting that the error propagates though:

    for middleware_path in settings.MIDDLEWARE_CLASSES:
    

    but you have what appears to be the exact default.

    You might want to check which python interpreter is pointed to by wsgi. Are you intending to use a virtualenv but wsgi is looking at your system install?

    You can also set the user and group that wsgi is running under. I use something like:

    WSGIDaemonProcess mysite.com user=skyl group=skyl processes=n threads=N python-path=/home/skyl/pinax/pinax-env2/lib/python2.6/site-packages

提交回复
热议问题