Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have trouble installing the django-socialregistration app!

Tags:

python

django

I'm a Django amateur, and have problems getting django-registration to work. I followed the installation instructions on their website, but for someone like me these instructions are not 100% clear as to what I should be doing. Here is what I've done:

  1. I installed the oauth2 and python-openid packages using pip. I then copied the facebook.py file from the facebook-python-sdk package to my main django app directory. (As I write this, I'm wondering whether this file should be copied to the socialregistration app directory? Does it make a difference?)
  2. I copied the socialregistration directory to my django project's directory.
  3. I added socialresgitration to my INSTALLED_APPS setting.
  4. To add socialregistration.urls to my urls.py file, I added the following line (not sure if this is correct, since the instructions don't give details):
    (r'^social/', include('socialregistration.urls')),
  5. I added the facebook API key and secret key to my settings
  6. I added socialregistration.auth.FacebookAuth to AUTHENTICATION_BACKENDS.
  7. I added socialregistration.middleware.FacebookMiddleware to MIDDLEWARE_CLASSES.
  8. Finally I added the three facebook tags they give in the instructions to one of my templates.
  9. When I then load my website, I get the folllowing error:
    Caught AttributeError while rendering: Please add the django.core.context_processors.request context processors to your settings.TEMPLATE_CONTEXT_PROCESSORS set

So, what can I do? I thought installation would be quite simple, but apparently this is not the case. ANY help would be appreciated!

Oh, BTW, I'm using Django 1.2.1 and Python 2.6.

Thanks!

like image 566
Helmut Avatar asked Aug 12 '10 06:08

Helmut


2 Answers

Please add the django.core.context_processors.request context processors to your settings.

Have you done that?

You'll need to change TEMPLATE_CONTEXT_PROCESSORS to include django.core.context_processors.request.

like image 62
Dominic Rodger Avatar answered Sep 24 '22 19:09

Dominic Rodger


I've found the problem. When my view renders the template, it needs to pass the RequestContext to the template.

return render_to_response('my_template.html', my_data_dictionary, context_instance=RequestContext(request))

Source: http://lincolnloop.com/blog/2008/may/10/getting-requestcontext-your-templates/

like image 39
Helmut Avatar answered Sep 23 '22 19:09

Helmut