Hi, Stas,
I replaced the 2.4 python with 2.6 in CentOS 5.4. I still got an error. When I try to visit the web page, I got the following in the log:
[root@localhost fs]# tail -f /var/log/httpd/wikipbx.yourserver.net-error.log
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1] [Errno 13] Permission denied: '/var/www/.python-eggs'
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1]
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1] The Python egg cache directory is currently set to:
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1]
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1] /var/www/.python-eggs
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1]
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1] Perhaps your account does not have write access to this directory? You can
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1] variable to point to an accessible directory.
[Sun Jan 31 14:56:47 2010] [error] [client 127.0.0.1]
Did I miss something? I installed everything using root account. After I do "chmod -R 777 /var/www/", I can see the login screen. However, I found the following error happens rather often if I just kept refreshing the login screen. Any clue on this? django is 5024 advised version. Thanks!
AttributeError at /
'WSGIRequest' object has no attribute 'user'
Request Method: GET
Request URL: http://localhost/
Exception Type: AttributeError
Exception Value: 'WSGIRequest' object has no attribute 'user'
Exception Location: /usr/src/django/django/core/context_processors.py in auth, line 18
Traceback (innermost last)
Switch to copy-and-paste view
* /usr/src/django/django/core/handlers/base.py in get_response
70. # Apply view middleware
71. for middleware_method in self._view_middleware:
72. response = middleware_method(request, callback, callback_args, callback_kwargs)
73. if response:
74. return response
75.
76. try:
77. response = callback(request, *callback_args, **callback_kwargs) …
78. except Exception, e:
79. # If the view raised an exception, run it through exception
80. # middleware, and if the exception middleware returns a
81. # response, use that. Otherwise, reraise the exception.
82. for middleware_method in self._exception_middleware:
83. response = middleware_method(request, e)
▶ Local vars
Variable Value
callback
<function index at 0x988e33c>
callback_args
()
callback_kwargs
{}
debug
<module 'django.views.debug' from '/usr/src/django/django/views/debug.py'>
e
AttributeError("'WSGIRequest' object has no attribute 'user'",)
exceptions
<module 'django.core.exceptions' from '/usr/src/django/django/core/exceptions.pyc'>
mail_admins
<function mail_admins at 0x9275a3c>
middleware_method
<bound method CommonMiddleware.process_request of <django.middleware.common.CommonMiddleware object at 0x9272fec»
request
<WSGIRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict: {}>, COOKIES:{}, META:{'DOCUMENT_ROOT': '/var/www/html', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.12) Gecko/2009072711 CentOS/3.0.12-1.el5.centos Firefox/3.0.12', 'PATH_INFO': '/', 'PATH_TRANSLATED': '/usr/src/wikipbx/wikipbx.wsgi/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '48318', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/', 'SCRIPT_FILENAME': '/usr/src/wikipbx/wikipbx.wsgi', 'SCRIPT_NAME': '', 'SERVER_ADDR': '127.0.0.1', 'SERVER_ADMIN': 'ten.revresruoy.xbpikiw|retsambew#ten.revresruoy.xbpikiw|retsambew', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>\n', 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)', 'mod_wsgi.application_group': 'wikipbx.yourserver.net|', 'mod_wsgi.callable_object': 'application', 'mod_wsgi.handler_script': '', 'mod_wsgi.input_chunked': '0', 'mod_wsgi.listener_host': '', 'mod_wsgi.listener_port': '80', 'mod_wsgi.process_group': '', 'mod_wsgi.request_handler': 'wsgi-script', 'mod_wsgi.script_reloading': '1', 'mod_wsgi.version': (3, 1), 'wsgi.errors': <mod_wsgi.Log object at 0x922b458>, 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0xb7e0f698>, 'wsgi.input': <mod_wsgi.Input object at 0x9270db8>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 1)}>
resolver
<django.core.urlresolvers.RegexURLResolver object at 0x97b148c>
response
None
self
<django.core.handlers.wsgi.WSGIHandler object at 0x912becc>
settings
<django.conf.LazySettings object at 0x922ffec>
urlconf
'wikipbx.urls'
urlresolvers
<module 'django.core.urlresolvers' from '/usr/src/django/django/core/urlresolvers.py'>
* /usr/src/wikipbx/wikipbx/wikipbxweb/views.py in index
41. from wikipbx.wikipbxweb.forms import *
42. from wikipbx.wikipbxweb.paginator import Paginator
43. from xml.dom import minidom
44.
45.
46. def index(request):
47. return simple.direct_to_template(
48. request, 'index.html', {'nousers': not User.objects.all()}) …
49.
50. def dashboard(request):
51. if not request.user.is_authenticated():
52. msg = "Must be logged in to view this resource"
53. return http.HttpResponseRedirect("/?urgentmsg=%s" % msg)
54. return simple.direct_to_template(request, 'dashboard.html')
▶ Local vars
Variable Value
request
<WSGIRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict: {}>, COOKIES:{}, META:{'DOCUMENT_ROOT': '/var/www/html', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.12) Gecko/2009072711 CentOS/3.0.12-1.el5.centos Firefox/3.0.12', 'PATH_INFO': '/', 'PATH_TRANSLATED': '/usr/src/wikipbx/wikipbx.wsgi/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '48318', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/', 'SCRIPT_FILENAME': '/usr/src/wikipbx/wikipbx.wsgi', 'SCRIPT_NAME': '', 'SERVER_ADDR': '127.0.0.1', 'SERVER_ADMIN': 'ten.revresruoy.xbpikiw|retsambew#ten.revresruoy.xbpikiw|retsambew', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>\n', 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)', 'mod_wsgi.application_group': 'wikipbx.yourserver.net|', 'mod_wsgi.callable_object': 'application', 'mod_wsgi.handler_script': '', 'mod_wsgi.input_chunked': '0', 'mod_wsgi.listener_host': '', 'mod_wsgi.listener_port': '80', 'mod_wsgi.process_group': '', 'mod_wsgi.request_handler': 'wsgi-script', 'mod_wsgi.script_reloading': '1', 'mod_wsgi.version': (3, 1), 'wsgi.errors': <mod_wsgi.Log object at 0x922b458>, 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0xb7e0f698>, 'wsgi.input': <mod_wsgi.Input object at 0x9270db8>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 1)}>
* /usr/src/django/django/views/generic/simple.py in direct_to_template
9. """
10. dictionary = {'params': kwargs}
11. for key, value in extra_context.items():
12. if callable(value):
13. dictionary[key] = value()
14. else:
15. dictionary[key] = value
16. c = RequestContext(request, dictionary) …
17. t = loader.get_template(template)
18. return HttpResponse(t.render(c), mimetype=mimetype)
19.
20. def redirect_to(request, url, **kwargs):
21. """
22. Redirect to a given URL.
▶ Local vars
Variable Value
dictionary
{'nousers': True, 'params': {}}
extra_context
{'nousers': True}
key
'nousers'
kwargs
{}
mimetype
None
request
<WSGIRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict: {}>, COOKIES:{}, META:{'DOCUMENT_ROOT': '/var/www/html', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.12) Gecko/2009072711 CentOS/3.0.12-1.el5.centos Firefox/3.0.12', 'PATH_INFO': '/', 'PATH_TRANSLATED': '/usr/src/wikipbx/wikipbx.wsgi/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '48318', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/', 'SCRIPT_FILENAME': '/usr/src/wikipbx/wikipbx.wsgi', 'SCRIPT_NAME': '', 'SERVER_ADDR': '127.0.0.1', 'SERVER_ADMIN': 'ten.revresruoy.xbpikiw|retsambew#ten.revresruoy.xbpikiw|retsambew', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>\n', 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)', 'mod_wsgi.application_group': 'wikipbx.yourserver.net|', 'mod_wsgi.callable_object': 'application', 'mod_wsgi.handler_script': '', 'mod_wsgi.input_chunked': '0', 'mod_wsgi.listener_host': '', 'mod_wsgi.listener_port': '80', 'mod_wsgi.process_group': '', 'mod_wsgi.request_handler': 'wsgi-script', 'mod_wsgi.script_reloading': '1', 'mod_wsgi.version': (3, 1), 'wsgi.errors': <mod_wsgi.Log object at 0x922b458>, 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0xb7e0f698>, 'wsgi.input': <mod_wsgi.Input object at 0x9270db8>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 1)}>
template
'index.html'
value
True
* /usr/src/django/django/template/context.py in init
93. def init(self, request, dict=None, processors=None):
94. Context.init(self, dict)
95. if processors is None:
96. processors = ()
97. else:
98. processors = tuple(processors)
99. for processor in get_standard_processors() + processors:
100. self.update(processor(request)) …
▶ Local vars
Variable Value
dict
{'nousers': True, 'params': {}}
processor
<function auth at 0x987c48c>
processors
()
request
<WSGIRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict: {}>, COOKIES:{}, META:{'DOCUMENT_ROOT': '/var/www/html', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.12) Gecko/2009072711 CentOS/3.0.12-1.el5.centos Firefox/3.0.12', 'PATH_INFO': '/', 'PATH_TRANSLATED': '/usr/src/wikipbx/wikipbx.wsgi/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '48318', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/', 'SCRIPT_FILENAME': '/usr/src/wikipbx/wikipbx.wsgi', 'SCRIPT_NAME': '', 'SERVER_ADDR': '127.0.0.1', 'SERVER_ADMIN': 'ten.revresruoy.xbpikiw|retsambew#ten.revresruoy.xbpikiw|retsambew', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>\n', 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)', 'mod_wsgi.application_group': 'wikipbx.yourserver.net|', 'mod_wsgi.callable_object': 'application', 'mod_wsgi.handler_script': '', 'mod_wsgi.input_chunked': '0', 'mod_wsgi.listener_host': '', 'mod_wsgi.listener_port': '80', 'mod_wsgi.process_group': '', 'mod_wsgi.request_handler': 'wsgi-script', 'mod_wsgi.script_reloading': '1', 'mod_wsgi.version': (3, 1), 'wsgi.errors': <mod_wsgi.Log object at 0x922b458>, 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0xb7e0f698>, 'wsgi.input': <mod_wsgi.Input object at 0x9270db8>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 1)}>
self
[{'nousers': True, 'params': {}}]
* /usr/src/django/django/core/context_processors.py in auth
11.
12. def auth(request):
13. """
14. Returns context variables required by apps that use Django's authentication
15. system.
16. """
17. return {
18. 'user': request.user, …
19. 'messages': request.user.get_and_delete_messages(),
20. 'perms': PermWrapper(request.user),
21. }
22.
23. def debug(request):
24. "Returns context variables helpful for debugging."
▶ Local vars
Variable Value
request
<WSGIRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict: {}>, COOKIES:{}, META:{'DOCUMENT_ROOT': '/var/www/html', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.12) Gecko/2009072711 CentOS/3.0.12-1.el5.centos Firefox/3.0.12', 'PATH_INFO': '/', 'PATH_TRANSLATED': '/usr/src/wikipbx/wikipbx.wsgi/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '48318', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/', 'SCRIPT_FILENAME': '/usr/src/wikipbx/wikipbx.wsgi', 'SCRIPT_NAME': '', 'SERVER_ADDR': '127.0.0.1', 'SERVER_ADMIN': 'ten.revresruoy.xbpikiw|retsambew#ten.revresruoy.xbpikiw|retsambew', 'SERVER_NAME': 'localhost', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at localhost Port 80</address>\n', 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)', 'mod_wsgi.application_group': 'wikipbx.yourserver.net|', 'mod_wsgi.callable_object': 'application', 'mod_wsgi.handler_script': '', 'mod_wsgi.input_chunked': '0', 'mod_wsgi.listener_host': '', 'mod_wsgi.listener_port': '80', 'mod_wsgi.process_group': '', 'mod_wsgi.request_handler': 'wsgi-script', 'mod_wsgi.script_reloading': '1', 'mod_wsgi.version': (3, 1), 'wsgi.errors': <mod_wsgi.Log object at 0x922b458>, 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0xb7e0f698>, 'wsgi.input': <mod_wsgi.Input object at 0x9270db8>, 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 1)}>
Traceback (most recent call last):
File "/usr/src/django/django/core/handlers/base.py" in get_response
77. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/src/wikipbx/wikipbx/wikipbxweb/views.py" in index
48. request, 'index.html', {'nousers': not User.objects.all()})
File "/usr/src/django/django/views/generic/simple.py" in direct_to_template
16. c = RequestContext(request, dictionary)
File "/usr/src/django/django/template/context.py" in init
100. self.update(processor(request))
File "/usr/src/django/django/core/context_processors.py" in auth
18. 'user': request.user,
AttributeError at /
'WSGIRequest' object has no attribute 'user'