Deploying django app on Apache mod_python

前端 未结 5 2152
名媛妹妹
名媛妹妹 2021-02-11 07:55

I\'ve finished making a site in django called \'kazbah\', and I\'m trying to deploy.

All the code for the kazbah site is in /home/git/DjangoProjects/kazbah and my httpd.

相关标签:
5条回答
  • 2021-02-11 08:28

    Louis, your configuration looks exactly like ones I used before I switched to mod_wsgi, so there must be something else wrong. Maybe you are missing an __init__.py file in /home/git/DjangoProjects/kazbah?

    0 讨论(0)
  • 2021-02-11 08:32

    Ok, maybe you have a syntax error in your settings file.

    Try this:

    $ cd /home/git/DjangoProjects/kazbah
    $ python
    >>> import settings
    

    Doing it this way will give you a much better error message if there are any errors.

    0 讨论(0)
  • 2021-02-11 08:49

    I'm pretty sure you can do the sys.path thing - it's in the django documentation.

    I might go over the django doc http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ as I was trying another tutorial(which is a bit outdated I think) - http://www.jeffbaier.com/2007/07/26/installing-django-on-an-ubuntu-linux-server/

    0 讨论(0)
  • 2021-02-11 08:51

    I've seen this a few times. Every time, it's been because I incorrectly set this line:

    SetEnv DJANGO_SETTINGS_MODULE kazbah.settings
    

    Even though it looked right, Django (actually python) was looking one folder off from the one I intended. Try tweaking it, changing it to:

    SetEnv DJANGO_SETTINGS_MODULE settings
    

    Also, you can tweak here:

    PythonPath "['/home/git/DjangoProjects'] + sys.path"
    

    It might be that you need to set it to:

    PythonPath "['/home/git/DjangoProjects/kazbah'] + sys.path"
    

    or something similar. Without seeing your actual folder setup, it's hard to know exactly. :)

    0 讨论(0)
  • 2021-02-11 08:53

    For a project resting under /var/www/bbb (called, "bbb"), I have the following set in the configuration file:

    <Location "/">
            SetHandler python-program
            PythonHandler django.core.handlers.modpython
            SetEnv DJANGO_SETTINGS_MODULE bbb.settings
            PythonPath "['/var/www/', '/var/www/bbb/'] + sys.path"
            PythonDebug On
    </Location>
    
    0 讨论(0)
提交回复
热议问题