我有Django的1.4.5自定義用戶配置文件和新鮮安裝pybbm一個項目爲包含在本說明書https://pybbm.readthedocs.org/en/latest/install.html#enable-your-site-profilePybbm超級用戶配置文件「UserProfile匹配查詢不存在」。
在此說明: 「如果你啓用了南部和東南部控制下使用配置文件類(如「pybb .profile')配置文件將不會在syncdb/migrate之後創建,它將在用戶第一次登錄pybb.middleware.PybbMiddleware時創建。
但在第一次超級用戶登錄時,我得到: 「UserProfile匹配查詢不存在。」
這個充滿回溯http://dpaste.com/1035237/
我看
/usr/local/lib/python2.7/dist-packages/pybb/middleware.py在process_request
這裏:
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()
但是沒有創建超級用戶的配置文件。
如何解決問題?
願你發佈錯誤的完整回溯(該行會生成錯誤)嗎?謝謝! :) – furins 2013-03-26 07:42:54
是的,完整的回溯在這裏http://dpaste.com/1035237/ – user1356067 2013-03-26 08:02:30
在我看來,中間件代碼應該趕上DoesNotExist異常,而不是ObjectDoesNotExist。但是,你有沒有改變檔案類? – furins 2013-03-26 08:09:50