Friends app failing to find SITE_NAME in settings

199 views
Skip to first unread message

wongobongo

unread,
May 6, 2011, 7:51:36 AM5/6/11
to Pinax Core Development
I'm using:

Pinax - 0.9a1
Django - 1.2.4
django-friends - 0.1.5

I'm trying to test the email invitation function (via facebox) which
uses django-friends but the following error occurs:

AttributeError at /invitations/invite/
'Settings' object has no attribute 'SITE_NAME'

/Users/kelvin/envs/visions/lib/python2.5/site-packages/friends/
models.py in send_invitation

123. "SITE_NAME": settings.SITE_NAME,
124. "CONTACT_EMAIL": settings.CONTACT_EMAIL,

https://github.com/jtauber/django-friends/blob/master/friends/models.py

There is also no CONTACT_EMAIL in my settings file. Should I be adding
those keys into my setting file? There is also a context processor
(pinax/core/context_processors.py) which reads similar keys out of the
database.

k

Olx

unread,
May 24, 2011, 12:25:30 PM5/24/11
to Pinax Core Development
I had the same issue. So had to add these two fields to settings.py
and that helped. But agree, would be nice to have these properties
generated for the project.

Thomas Schreiber

unread,
May 29, 2011, 4:58:53 AM5/29/11
to pinax-c...@googlegroups.com
Check out pinax/pinax/core/context_processors.py and
https://docs.djangoproject.com/en/dev/ref/contrib/sites/#hooking-into-the-current-site-from-views

You don't need to add SITE_NAME to settings.py, simply create your
site in the database (can use the admin) and set the SITE_ID, also
make sure you are including this context processor in your settings.

TEMPLATE_CONTEXT_PROCESSORS = [
...
"pinax.core.context_processors.pinax_settings",
...
]

> --
> You received this message because you are subscribed to the Google Groups "Pinax Core Development" group.
> To post to this group, send email to pinax-c...@googlegroups.com.
> To unsubscribe from this group, send email to pinax-core-de...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pinax-core-dev?hl=en.
>
>

wongobongo

unread,
May 29, 2011, 7:23:16 PM5/29/11
to Pinax Core Development
Thanks for your reply Thomas. My understanding is that context
processors inject global/sitewide variables into the templates and not
the settings object - if this is incorrect please let me know. I
concluded that the error was generated by code in the model not the
template (the SITE_DOMAIN, etc. keys exists in the template just as
you would expect). Specifically lines 123 and 124 in the
send_invitation method of the JoinInvitationManager class pull non-
existent keys from the settings object raising an AttributeError.

https://github.com/jtauber/django-friends/blob/master/friends/models.py

I have both pinax's context processor installed and Site 1 configured
in the database as you directed (settings.SITE_ID=1). Yet, one URL in
the site generates errors (try inviting someone by email using the
form in social site - on submit, it raises no errors? Root-relative
URL is "/invitations/invite/").

K

---

AttributeError at /invitations/invite/

'Settings' object has no attribute 'SITE_NAME'

Request Method: POST
Request URL: http://localhost:8888/invitations/invite/
Django Version: 1.2.5
Exception Type: AttributeError
Exception Value:

'Settings' object has no attribute 'SITE_NAME'



On May 29, 1:58 am, Thomas Schreiber <t...@insatsu.us> wrote:
> Check out  pinax/pinax/core/context_processors.py andhttps://docs.djangoproject.com/en/dev/ref/contrib/sites/#hooking-into...

Thomas Schreiber

unread,
May 30, 2011, 3:17:04 AM5/30/11
to pinax-c...@googlegroups.com
On Mon, May 30, 2011 at 01:23, wongobongo <wong...@gmail.com> wrote:
> Thanks for your reply Thomas. My understanding is that context
> processors inject global/sitewide variables into the templates and not
> the settings object - if this is incorrect please let me know. I
> concluded that the error was generated by code in the model not the
> template (the SITE_DOMAIN, etc. keys exists in the template just as
> you would expect). Specifically lines 123 and 124 in the
> send_invitation method of the JoinInvitationManager class pull non-
> existent keys from the settings object raising an AttributeError.
>
> https://github.com/jtauber/django-friends/blob/master/friends/models.py

Hmm, I actually haven't used django-friends yet, so maybe someone that
is can report back. However, it looks like the
JoinInvitationManager.send_invitation method should be setting the
SITE_NAME from get_current() and not from settings.SITE_NAME, or
checking to see if pinax is used since the
`context_processors.pinax_settings` would also be adding it.

Might be a bug, especially since django-friends is intended to be used
with and without Pinax, there may have been an oversight here.

> I have both pinax's context processor installed and Site 1 configured
> in the database as you directed (settings.SITE_ID=1). Yet, one URL in
> the site generates errors (try inviting someone by email using the
> form in social site - on submit, it raises no errors? Root-relative
> URL is "/invitations/invite/").

I do know that the CONTACT_EMAIL must be set in the main settings.


>
> K
>
> ---
>
> AttributeError at /invitations/invite/
>
> 'Settings' object has no attribute 'SITE_NAME'
>
> Request Method:         POST
> Request URL:    http://localhost:8888/invitations/invite/
> Django Version:         1.2.5
> Exception Type:         AttributeError
> Exception Value:
>
> 'Settings' object has no attribute 'SITE_NAME'
>
>
>
> On May 29, 1:58 am, Thomas Schreiber <t...@insatsu.us> wrote:
>> Check out  pinax/pinax/core/context_processors.py andhttps://docs.djangoproject.com/en/dev/ref/contrib/sites/#hooking-into...
>>
>> You don't need to add SITE_NAME to settings.py, simply create your
>> site in the database (can use the admin) and set the SITE_ID, also
>> make sure you are including this context processor in your settings.
>>
>> TEMPLATE_CONTEXT_PROCESSORS = [
>>     ...
>>     "pinax.core.context_processors.pinax_settings",
>>     ...
>> ]
>>
>

Reply all
Reply to author
Forward
0 new messages