当我运行我的django测试时,我得到以下错误,这些错误在我的测试套件之外:
======================================================================
ERROR: test_known_user (django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py", line 160, in test_known_user
super(RemoteUserCustomTest, self).test_known_user()
File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py", line 67, in test_known_user
self.assertEqual(response.context['user'].username, 'knownuser')
TypeError: 'NoneType' object is unsubscriptable
======================================================================
ERROR: test_last_login (django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py", line 87, in test_last_login
self.assertNotEqual(default_login, response.context['user'].last_login)
TypeError: 'NoneType' object is unsubscriptable
======================================================================
ERROR: test_no_remote_user (django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py", line 33, in test_no_remote_user
self.assert_(isinstance(response.context['user'], AnonymousUser))
TypeError: 'NoneType' object is unsubscriptable
======================================================================
ERROR: …Run Code Online (Sandbox Code Playgroud) 我的 Django 项目正在与第三方论坛合作。正在通过 发送activation_email get_current_site(request)。密码休息是由password_reset从django.contrib.auth.views import.
对于另一个应用程序,我需要安装django.contrib.sites. 通过这get_current_site(request)并没有给我当前的站点,而是从django.contrib.sites.models. 问题是:
我的项目已经上线了。所以我想我可以删除example.com并添加我的域名。但是现在我无法再登录,并且出现此错误:
django.contrib.sites.models.DoesNotExist: Site matching query does not exist.
Django应用程序具有自己的功能和设计.如果您的要求与contib应用程序的功能不完全匹配,则最终会自定义和调整应用程序.我觉得这比仅仅构建自己的应用程序以满足您的需求需要更多的努力.
你怎么看?
我正在关注本教程:
http://docs.djangoproject.com/en/dev/ref/contrib/messages/
但我得到这个错误:
Error: No module named messages
Run Code Online (Sandbox Code Playgroud)
.
并且在django/contrib文件夹中有效地没有消息应用程序.
我如何获得工作消息框架?
我正在尝试使用GeoIP2 for Django,它要求您在设置中设置国家和城市数据集的路径GEOIP_PATH.我的问题是我不知道我应该把这个设置放在哪里,以便像Python shell这样的东西可以看到它.
我假设它会进入settings.py,但我不确定这个特定模块的语法,并且Django文档是关于此的绝对垃圾.
Django现在提供了一个在Django模型中使用的BigIntegerField(可在svn trunk和1.2 alpha-1版本中使用)。
我需要django.contrib.auth.user模型具有一个BigIntegerField作为其自动递增主键,而当前它使用一个自动递增的IntegerField作为其主键。另外,无论在哪里contrib.auth.user用作ForeginKey,也都必须是BigIntegerField。
实现此目标的最佳和最安全的方法是什么?