我在django 1.4.5上有一个项目,带有自定义的用户配置文件和新安装的pybbm,如本说明https://pybbm.readthedocs.org/en/latest/install.html#enable-your-site-profile中所述
在本说明中:“如果您启用了南向并使用南向控制下的配置文件类(如‘pybb.Profile’),将不会在同步/迁移后创建超级用户的配置文件。它将在此用户首次通过pybb.middleware.PybbMiddleware登录到站点时创建。”
但是在第一次超级用户登录时,我得到了:"UserProfile匹配查询不存在“。
这是完整的回溯http://dpaste.com/1035237/
我看着
process_request中的/usr/local/lib/python2.7/dist-packages/pybb/middleware.py
这里:
if request.user.is_authenticated():
try:
# Here we try to load profile, but can get error
# if user created during syncdb but profile model
# under south control. (Like pybb.Profile).
profile = request.user.get_profile()
except ObjectDoesNotExist:
# Ok, we should create new profile for this user
# and grant permissions for add posts
user_saved(request.user, created=True)
profile = request.user.get_profile()但未创建超级用户的配置文件。
如何解决问题?
发布于 2013-03-28 20:28:44
检查settings.py中是否启用了'pybb.middleware.PybbMiddleware‘
https://stackoverflow.com/questions/15631734
复制相似问题