First time here? Check out the FAQ!

Fabio's profile - activity

9 years ago received badge Taxonomist
10 years ago received badge Popular Question (source)
11 years ago received badge Notable Question (source)
12 years ago received badge Famous Question (source)
12 years ago received badge Popular Question (source)
13 years ago received badge Famous Question (source)
13 years ago received badge Famous Question (source)
13 years ago received badge Nice Question (source)
13 years ago received badge Notable Question (source)
13 years ago received badge Popular Question (source)
13 years ago answered a question Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

Yes, I solved my problem :-) Thanks to Evgeny.

13 years ago received badge Scholar ( source )
13 years ago marked best answer Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

This could be caused by several things:

  • models out of date - run python manage.py syncdb and python manage.py migrate
  • missing 'django.core.context_processors.request', in the TEMPLATE_CONTEXT_PROCESSORS
  • urlpatterns tuple is empty, urls.py - in the django project root.

Askbot provides a sample urls.py in the directory askbot/setup_templates, you can take it there, or run askbot-setup. askbot-setup will make a copy, but will not overwrite an existing file though.

13 years ago answered a question Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

Hi Fitoria, I check the path of TEMPLATE_DIR, but it seems correct.

Maybe this log can help you to find the solution:

[Tue Sep 27 16:02:36 2011] [error] /home/webapp/lib/python2.6/coffin/common.py:49: UserWarning: Cannot translate loader: askbot.skins.loaders.load_template_source
[Tue Sep 27 16:02:36 2011] [error]   warnings.warn('Cannot translate loader: %s' % loader)
[Tue Sep 27 16:02:36 2011] [error] <WSGIRequest
[Tue Sep 27 16:02:36 2011] [error] GET:<QueryDict: {}>,
[Tue Sep 27 16:02:36 2011] [error] POST:<QueryDict: {}>,
[Tue Sep 27 16:02:36 2011] [error] COOKIES:{'sessionid': 'ac06b15de9368da994923c9202971198'},
[Tue Sep 27 16:02:36 2011] [error] META:{'DOCUMENT_ROOT': '/usr/local/apache2/htdocs',
[Tue Sep 27 16:02:36 2011] [error]  'GATEWAY_INTERFACE': 'CGI/1.1',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_ACCEPT': '*/*',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_ACCEPT_LANGUAGE': 'it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_CONNECTION': 'close',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_COOKIE': 'sessionid=ac06b15de9368da994923c9202971198',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_HOST': 'webapp.webfactional.com',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_X_FORWARDED_FOR': '2.225.106.8',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_X_FORWARDED_HOST': 'webapp.webfactional.com',
[Tue Sep 27 16:02:36 2011] [error]  'HTTP_X_FORWARDED_SERVER': 'webapp.webfactional.com',
[Tue Sep 27 16:02:36 2011] [error]  'PATH_INFO': u'/favicon.ico',
[Tue Sep 27 16:02:36 2011] [error]  'PATH_TRANSLATED': '/home/webapp/webapps/django/myproject.wsgi/favicon.ico',
[Tue Sep 27 16:02:36 2011] [error]  'QUERY_STRING': '',
[Tue Sep 27 16:02:36 2011] [error]  'REMOTE_ADDR': '127.0.0.1',
[Tue Sep 27 16:02:36 2011] [error]  'REMOTE_PORT': '46926',
[Tue Sep 27 16:02:36 2011] [error]  'REQUEST_METHOD': 'GET',
[Tue Sep 27 16:02:36 2011] [error]  'REQUEST_URI': '/favicon.ico',
[Tue Sep 27 16:02:36 2011] [error]  'SCRIPT_FILENAME': '/home/webapp/webapps/django/myproject.wsgi',
[Tue Sep 27 16:02:36 2011] [error]  'SCRIPT_NAME': u'',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_ADDR': '127.0.0.1',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_ADMIN': '[no address given]',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_NAME': 'webapp.webfactional.com',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_PORT': '80',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_PROTOCOL': 'HTTP/1.0',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_SIGNATURE': '',
[Tue Sep 27 16:02:36 2011] [error]  'SERVER_SOFTWARE': 'Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.1',
[Tue Sep 27 16:02:36 2011] [error]  'mod_wsgi.application_group': 'web223.webfaction.com|',
[Tue Sep 27 ...
(more)
13 years ago commented answer Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

Hi Evgeny, I simply try to access to root url or to /admin location.

13 years ago answered a question Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

This is my settings.py:

#!/usr/bin/env python26

# Django settings for myproject project.

#ASKBOT
import os.path
import logging
import sys
import askbot
import os

DEBUG = False
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', 'your_email@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '*************',                      # Or path to database file if using sqlite3.
        'USER': '*************',                      # Not used with sqlite3.
        'PASSWORD': '*************',                  # Not used with sqlite3.
        'HOST': '*************',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}


#ASKBOT
#outgoing mail server settings
SERVER_EMAIL = '************'
DEFAULT_FROM_EMAIL = '************'
EMAIL_HOST_USER = '************'
EMAIL_HOST_PASSWORD = ''
EMAIL_SUBJECT_PREFIX = ''
EMAIL_HOST=''
EMAIL_PORT=''
EMAIL_USE_TLS=False
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

IMAP_HOST = ''
IMAP_HOST_USER = ''
IMAP_HOST_PASSWORD = ''
IMAP_PORT = ''
IMAP_USE_TLS = False



# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = '/home/webapp/webapps/media/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = 'http://webapp.webfactional.com/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = 'http://webapp.webfactional.com/media/admin/'


#ASKBOT
#this line is added so that we can import pre-packaged askbot dependencies
sys.path.append(os.path.join(os.path.dirname(askbot.__file__), 'deps'))

PROJECT_ROOT = os.path.join(os.path.dirname(__file__), 'forum')
ASKBOT_FILE_UPLOAD_DIR = os.path.join(os.path.dirname(__file__), 'forum', 'askbot', 'upfiles')


# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make ...
(more)
13 years ago commented answer Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

Hi Evgeny, I did as you tell, but I continue to have the same error.

13 years ago answered a question Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

I have installed askbot on webfaction server as a reusable django application, but I have gott this error:

[Sun Sep 25 23:51:40 2011] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.1 configured -- resuming normal operations
[Sun Sep 25 16:51:44 2011] [error] /home/webapp/lib/python2.6/coffin/common.py:49: UserWarning: Cannot translate loader: askbot.skins.loaders.load_template_source
[Sun Sep 25 16:51:44 2011] [error]   warnings.warn('Cannot translate loader: %s' % loader)
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1] mod_wsgi (pid=9004): Exception occurred processing WSGI script '/home/webapp/webapps/django/myproject.wsgi'.
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/core/handlers/wsgi.py", line 272, in __call__
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     response = self.get_response(request)
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/core/handlers/base.py", line 153, in get_response
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/core/handlers/base.py", line 218, in handle_uncaught_exception
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     return callback(request, **param_dict)
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/utils/decorators.py", line 93, in _wrapped_view
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     response = view_func(request, *args, **kwargs)
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/views/defaults.py", line 31, in server_error
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     return http.HttpResponseServerError(t.render(Context({})))
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/template/base.py", line 123, in render
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     return self._render(context)
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/template/base.py", line 117, in _render
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     return self.nodelist.render(context)
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]   File "/home/webapp/lib/python2.6/django/template/base.py", line 744, in render
[Sun Sep 25 16:51:44 2011] [error] [client 127.0.0.1]     bits.append(self.render_node(node, context))
[Sun Sep 25 16:51:44 2011] [error] [client ...
(more)
13 years ago asked a question Django error: VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

Can anybody explain to me how to deal with the error as in the question title?

13 years ago received badge Supporter (source)
13 years ago commented answer Why askbot template base.html has become the default base template?
Ok, but this means that askbot has changed my default template engine?
13 years ago asked a question Why askbot template base.html has become the default base template?

Hi,

can anybody explain this error?

In template /usr/lib/python2.6/site-packages/askbot-0.7.19-py2.6.egg/askbot/skins/default/templates/base.html, error at line 4 Could not parse the remainder: '()' from 'skin.get_extra_css_link()'

I get it when I try to access to search directory of "haystacksearch".

Fabio

14 years ago answered a question How to use askbot as a pluggable django app?

No, as far I know I don't have any custom skin.

14 years ago answered a question How to use askbot as a pluggable django app?

Hi managed to install askbot as a pluggable django app, but I have some two probles:

  1. I had to create, under my project directory, a virtual link to skins folder

  2. despite I tell askbot to put the uploaded file into the directory /myproject/upfile, askbot continue to put the uploaded file into directory /myproject/askbot/upfile.

Regards,

Fabio

14 years ago received badge Self-Learner ( source )
14 years ago answered a question How to run askbot under a subdirectory?

I have just run the command python manage.py add_missing_subscriptions and I think that there is a typo. I get the error is AttributeError: type object 'User' has no attribute 'object' and infact in the script add_missing_subscriptions there is the command User.object.all() that instead should be User.objects.all()

14 years ago received badge Self-Learner ( source )
14 years ago received badge Teacher ( source )
14 years ago answered a question How to run askbot under a subdirectory?

Solved! There was a line with USE_I18N = False. When I set USE_I18N to True the problem got solved.

14 years ago answered a question How to run askbot under a subdirectory?

Hi, Evgeny,

as suggested by you I try to install askbost as an app of django but without success. I have this error:

    [Sat Jun 18 16:47:12 2011] [error]   warnings.warn('Cannot translate loader: %s' % loader)
[Sat Jun 18 16:47:12 2011] [error] /usr/lib/python2.6/site-packages/Coffin-0.3.4-py2.6.egg/coffin/common.py:49: UserWarning: Cannot translate loader: askbot.skins.loaders.load_template_source
[Sat Jun 18 16:47:12 2011] [error]   warnings.warn('Cannot translate loader: %s' % loader)
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8] mod_wsgi (pid=16245): Exception occurred processing WSGI script '/opt/djroot/djadmin/apache/django.wsgi'.
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8] Traceback (most recent call last):
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 250, in __call__
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     self.load_middleware()
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 45, in load_middleware
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     mod = import_module(mw_module)
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     __import__(name)
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/askbot-0.6.95-py2.6.egg/askbot/middleware/view_log.py", line 12, in <module>
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     from askbot.views.readers import questions as questions_view
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/askbot-0.6.95-py2.6.egg/askbot/views/__init__.py", line 4, in <module>
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     from askbot.views import readers
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/askbot-0.6.95-py2.6.egg/askbot/views/readers.py", line 36, in <module>
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     from askbot.templatetags import extra_tags
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/askbot-0.6.95-py2.6.egg/askbot/templatetags/extra_tags.py", line 8, in <module>
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]     from askbot.skins.loaders import get_template
[Sat Jun 18 16:47:12 2011] [error] [client 2.225.106.8]   File "/usr/lib/python2.6/site-packages/askbot-0.6.95-py2.6.egg/askbot/skins/loaders.py", line 121, in <module>
[Sat Jun 18 16:47:12 2011 ...
(more)
14 years ago answered a question How to run askbot under a subdirectory?

Nobody can help me?

Fabio

14 years ago answered a question How to run askbot under a subdirectory?

Thanks for your reply.

WSGIScriptAlias ​​If set to '/ forum' and ASKBOT_URL to 'forum /' images are served to the URL '/ forum / forum / m / default / media / images /' (eg forum / forum / m / default / media / images / cc-Wiki.png? v = 1) but the URL is written by askbot '/ forum / m / default / media / images'.

If, instead, I set WSGIScriptAlias to '/' and ASKBOT_URL to 'forum /', askbot load properly, but I am no longer able to access my django site through the url http://localhost/django.

Fabio

14 years ago received badge Student (source)
14 years ago asked a question How to run askbot under a subdirectory?

Askbot I installed on a server (CentOS + Apache) with a single IP address. On the same server are running the main site (php) and a Django site (version 1.3). Django Django is served under the subdirectory / (defined by the Directive WSGIScriptAlias ​​/ django) I would like to serve in a subdirectory askbot / forum, but even if they define the WSGIScriptAlias ​​/ forum url media continue to point to / m, while it should point to / forum / m Can anyone help me?

Fabio