Django newbie deployment question - ImportError: Could not import settings 'settings'

前端 未结 2 2102
离开以前
离开以前 2021-02-07 12:34

The app runs fine using django internal server however when I use apache + mod_python I get the below error


  File \"/usr/local/lib/python2.6/dist-package         


        
2条回答
  •  难免孤独
    2021-02-07 13:23

    Your apache configuration should look like this:

    
        SetHandler python-program
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE mysite.settings
        PythonOption django.root /mysite
        PythonPath "['/root/djangoprojects/', '/root/djangoprojects/mysite','/root/djangoprojects/mysite/polls', '/var/www'] + sys.path"
        PythonDebug On
    
    

    Note that the sole difference is the "mysite.settings". Don't forget to restart apache once the config has changed (apache2ctl restart). See http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ for more info.

提交回复
热议问题