Django mod-python error
Can someone please tell what this strange error is
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch
log=debug)
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 464, in import_module
module = imp.load_module(mname, f, p, d)
File "/project/django/django/core/handlers/modpython.py", line 4, in ?
from django import http
File "/project/django/django/http/__init__.py", line 3, in ?
from Cookie import SimpleCookie, CookieError
ImportError: No module named Cookie
Edit:
Python
Python 2.4.3 (#1, Jan 14 2008, 18:32:40)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "开发者_开发百科license" for more information.
>>> from Cookie import SimpleCookie, CookieError
>>> from http.Cookie import SimpleCookie, CookieError
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named http.Cookie
>>> import Cookie
>>> import http.Cookie
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named http.Cookie
>>> import http.Cookie
That you're missing the Cookie package (which is not part of Django), but it should be Builtin.
If you're using Python 3 please note that Cookie
has been renamed to http.cookies
, and that Django is incompatible with Python not 2.x.
That is what you're missing: http://docs.python.org/library/cookie.html.
Edit
I see you're running python 2.4. Consider switch to python 2.6 or 2.7, and check the presence of /usr/lib/python2.4/Cookie.py
Solution
The path was missing, so adding
sys.path.append('/usr/lib/python2.4/')
solves the issue.
精彩评论