cfpb / idea-box

An application that lets an organization collect ideas, comment on them, and vote them up.
Creative Commons Zero v1.0 Universal
158 stars 49 forks source link

How can I fix SiteProfileNotAvailable exception #88

Open channaitfac opened 9 years ago

channaitfac commented 9 years ago

I have I configured and deploy the application. But when I going to read some comment I will get following exception,

Exception Type: SiteProfileNotAvailable Exception Value: You need to set AUTH_PROFILE_MODULE in your project settings

But I haven't any idea to how too set proper value for "AUTH_PROFILE_MODULE" (under src\collab\collab\settings.py).

Now I am using following values,

application name is 'idea' I have created user call 'dev'

AUTH_PROFILE_MODULE = 'idea.dev'

Can you please tell me how can I derive that values ?

Thanks.

m3brown commented 9 years ago

Try setting AUTH_PROFILE_MODULE to 'auth.User', which is the default Django user model.

Let me know if that addresses the issue. If so, I'll update the README accordingly, it appears to be a requirement for the comment module to function properly.

channaitfac commented 9 years ago

Many thanks for your worth full answer.

I have applied the value as you have mention (on settings.py file), AUTH_PROFILE_MODULE = 'auth.User'

But still I am getting same exception.

This exception occur when I going to,

Note:- When I select records in "django_comments" table, table column "is_removed" contains value "false" for all records. When I update that value as "true" (UPDATE django_comments SET is_removed = true;) then application works with out any errors. But when I add another new "Comment", again it will contains "false" for "is_removed" filed. Then again I can not view that Comment and then I have to update that value to "true".

But I can proceed other operations without any issue, ex: post new "Idea" and do "Like" it .

I have remove the "projectegg = idea" entry on buildout.cfg file because it course to "Error: The projectegg option is deprecated" with "buildout" command. .

Other than that I have proceeded only basic configuration steps that mention on read me file.

I have posted detail exception message and relevant trace values as bellow,

Can you please help me to resolve this issue.

Thanks a lot.

----------- Exception detail ----------------- SiteProfileNotAvailable at /detail/2/ You need to set AUTH_PROFILE_MODULE in your project settings

Request Method: GET Request URL: http://127.0.0.1:8000/detail/2/ Django Version: 1.5.4 Exception Type: SiteProfileNotAvailable Exception Value: You need to set AUTH_PROFILE_MODULE in your project settings Exception Location: c:\python27\lib\site-packages\django\contrib\auth\models.py in get_profile, line 435 Python Executable: C:\Python27\python.exe Python Version: 2.7.9

----------- Trace values ----------------- c:\python27\lib\site-packages\django\contrib\auth\models.py in get_profile

  1. 'You need to set AUTH_PROFILE_MODULE in your project '

    ▼ Local vars Variable Value self "User: dev" settings "django.conf.LazySettings object at 0x01E64BB0"

m3brown commented 9 years ago

Okay, so I was able to recreate the comment issue. It looks like the code here is not able to run get_profile using the auth.User model. The erroring line in auth.User is here. I don't currently have time to dig into a proper fix, but perhaps the easiest solution is to create a template tag to safely run and catch get_profile and return None if SiteProfileNotAvailable is thrown.

m3brown commented 9 years ago

Also, note this doesn't impact CFPB's system because we run ideabox inside of collab, and the CollabUser/Person combo resolves get_profile() without any issues.

panduit-bew commented 2 years ago

I am getting the following: FieldError at /idea/detail/2/ Cannot resolve keyword 'user' into field. Choices are: comment_comments, comment_flags, date_joined, email, first_name, groups, id, idea, idea_vote_creator, is_active, is_staff, is_superuser, last_login, last_name, logentry, password, taggit_taggeditem_related, user_permissions, username, vote

Is this because it should be username instead of user?