开发者

Problem with deploying django application on mod_wsgi [closed]

开发者 https://www.devze.com 2023-02-14 19:58 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

I seem to have a problem deploying django with mod_wsgi. In the past I've used mod_python but I want to make the change. I have been using Graham Dumpleton notes here http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango1, but it still seem to not work. I get a Internal Server Error.

django.wsgi file:

import os
import sys

sys.path.append('/var/www/html')
sys.path.append('/var/www/html/c2duo_crm')

os.environ['DJANGO_SETTINGS_MODULE'] = 'c2duo_crm.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

WSGIScriptAlias / /var/www/html/c2duo_crm/apache/django.wsgi

Apache httpd file:

<Directory /var/www/html/c2duo_crm/apache>
Order allow,deny
Allow from all
</Directory>

In my apache error log, it says I have this error This is not all of it, but I've got the most important part:

[Errno 13] Permission denied: '/.python-eggs'
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] The Python egg cache directory is currently set to:
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]   /.python-eggs
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] Perhaps your account does not have write access to this directory?  You can
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Thu Mar 03 14:59:25 2011] [error] [cl开发者_运维知识库ient 127.0.0.1] variable to point to an accessible directory.


Python Eggs are module files that are contained within zip files. The Python Egg Cache is the directory where Python extracts them so it can run them. Currently you are trying to extract them to /.python-eggs but you don't have write access to either that directory, or to / if it doesn't exist.

You have two options, you can either create /.python-eggs and make it world writable (or at least writable by the user Apache is running as), or you can set PYTHON_EGG_CACHE (using the WSGIPythonEggs directive) to a directory where you do have write access.


# Avoid [Errno 13] Permission denied: '/var/www/.python-eggs' messages
import os

os.environ['PYTHON_EGG_CACHE'] = '/tmp'
0

精彩评论

暂无评论...
验证码 换一张
取 消