我在试用django-lean时,发现有一些奇怪的行为,有时会显示测试或控件,但有时两者都不会显示(对于同一个请求)。
我用./manage.py test experimets运行测试,有两个测试失败:
======================================================================
FAIL: testIntegrationWithAnonymousVisitor (experiments.tests.test_tags.ExperimentTagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 35, in testIntegrationWithAnonymousVisitor
client_factory=lambda i: Client())
File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 76, in doTestIntegration
self.assertTrue(in_test != in_control)
AssertionError: False is not true
======================================================================
FAIL: testIntegrationWithRegisteredUser (experiments.tests.test_tags.ExperimentTagsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 55, in testIntegrationWithRegisteredUser
client_factory=create_registered_user_client)
File "/home/ubuntu/dev/skin/experiments/tests/test_tags.py", line 76, in doTestIntegration
self.assertTrue(in_test != in_control)
AssertionError: False is not true这里到底发生了什么?
发布于 2014-01-27 04:22:31
我自己也遇到了同样的问题..解决方案就在文档中:
确保django.core.context_processors.request在settings.py中的
TEMPLATE_CONTEXT_PROCESSORS中
这应该在您的settings.py中
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request",
)https://stackoverflow.com/questions/14562220
复制相似问题