Django facebook integration error
- by Gaurav
I'm trying to integrate facebook into my application so that users can use their FB login to login to my site. I've got everything up and running and there are no issues when I run my site using the command line
python manage.py runserver
But this same code refuses to run when I try and run it through Apache.
I get the following error:
Environment:
Request Method: GET
Request URL: http://helvetica/foodfolio/login
Django Version: 1.1.1
Python Version: 2.6.4
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'foodfolio.app',
'foodfolio.facebookconnect']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'facebook.djangofb.FacebookMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'facebookconnect.middleware.FacebookConnectMiddleware')
Template error:
In template /home/swat/website-apps/foodfolio/facebookconnect/templates/facebook/js.html, error at line 2
Caught an exception while rendering: No module named app.models
1 : <script type="text/javascript">
2 : FB_RequireFeatures(["XFBML"], function() {FB.Facebook.init("{{ facebook_api_key }}", " {% url facebook_xd_receiver %} ")});
3 :
4 : function facebookConnect(loginForm) {
5 : FB.Connect.requireSession();
6 : FB.Facebook.get_sessionState().waitUntilReady(function(){loginForm.submit();});
7 : }
8 : function pushToFacebookFeed(data){
9 : if(data['success']){
10 : var template_data = data['template_data'];
11 : var template_bundle_id = data['template_bundle_id'];
12 : feedTheFacebook(template_data,template_bundle_id,function(){});
Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
92. response = callback(request, *callback_args, **callback_kwargs)
File "/home/swat/website-apps/foodfolio/app/controller.py" in __showLogin__
238. context_instance = RequestContext(request))
File "/usr/lib/pymodules/python2.6/django/shortcuts/__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/lib/pymodules/python2.6/django/template/loader.py" in render_to_string
108. return t.render(context_instance)
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
178. return self.nodelist.render(context)
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
779. bits.append(self.render_node(node, context))
File "/usr/lib/pymodules/python2.6/django/template/debug.py" in render_node
71. result = node.render(context)
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
946. autoescape=context.autoescape))
File "/usr/lib/pymodules/python2.6/django/template/__init__.py" in render
779. bits.append(self.render_node(node, context))
File "/usr/lib/pymodules/python2.6/django/template/debug.py" in render_node
81. raise wrapped
Exception Type: TemplateSyntaxError at /foodfolio/login
Exception Value: Caught an exception while rendering: No module named app.models