Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4253236
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:55:09+00:00 2026-05-21T04:55:09+00:00

Hi i was trying to implement facebook login for my django app using django-facebook

  • 0

Hi i was trying to implement facebook login for my django app using django-facebook connect using Ajax. I was following this link for implementing it facebook-django integration with ajax. On doing so i am hit with this error ” TemplateSyntaxError at /registrationForm/

‘facebookconnect’ is not a valid tag library: Template library facebookconnect not found, tried django.templatetags.facebookconnect,django.contrib.admin.templatetags.facebookconnect,facebookconnect.templatetags.facebookconnect “. I will paste my error log here. Environment:

Request Method: GET
Request URL: http://10.1.0.90:8080/registrationForm/
Django Version: 1.2.5
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'universityDetails',
 'django.contrib.admin',
 'captcha',
 'facebookconnect',
 'social_auth']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.middleware.csrf.CsrfResponseMiddleware',
 'universityDB.FacebookConnectMiddleware.FacebookConnectMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'facebook.djangofb.FacebookMiddleware',
 'facebookconnect.middleware.FacebookConnectMiddleware')


Template error:
In template /home/ravi/Desktop/universityDB/templates/registrationForm.html, error at line 75
   'facebookconnect' is not a valid tag library: Template library facebookconnect not found, tried django.templatetags.facebookconnect,django.contrib.admin.templatetags.facebookconnect,facebookconnect.templatetags.facebookconnect
   65 :   <p style="clear:both;float:left;">


   66 :     <input type="submit" value="Log in" />


   67 :     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


   68 :     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a HREF="http://10.1.0.90:8080/forgotPassword/">Forgotten your password?</a></p>


   69 :   </div>


   70 : </form>


   71 : <br>


   72 : 


   73 : <p>Login via facebook!</p>


   74 : 


   75 :  {% load facebookconnect %} 


   76 : {% facebook_connect_login_button %}


   77 : 


   78 : {% facebook_connect_script %}


   79 : 


   80 : 


   81 : 


   82 : <br>


   83 : <br>


   84 : <br>


   85 : <br>


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
  100.                     response = callback(request, *callback_args, **callback_kwargs)
File "/home/ravi/Desktop/universityDB/../universityDB/universityDetails/views.py" in registrationForm
  50.     return render_to_response("registrationForm.html")
File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in render_to_string
  181.         t = get_template(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in get_template
  157.     template, origin = find_template(template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in get_template_from_string
  168.     return Template(source, origin, name)
File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in __init__
  158.         self.nodelist = compile_string(template_string, origin)
File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in compile_string
  186.     return parser.parse()
File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in parse
  282.                     compiled_result = compile_func(self, token)
File "/usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py" in load
  928.                                       (taglib, e))

Exception Type: TemplateSyntaxError at /registrationForm/
Exception Value: 'facebookconnect' is not a valid tag library: Template library facebookconnect not found, tried django.templatetags.facebookconnect,django.contrib.admin.templatetags.facebookconnect,facebookconnect.templatetags.facebookconnect

My directory structure is

universityDB/   
        universityDetails
           models.py
           views.py
           urls.py
        templates/
                xd_receiver.htm
        templatetags/
        __init__.py
        facebookconnect.py

and my facebookconnect.py is

from django import template
from django.conf import settings
from django.core.urlresolvers import reverse

register = template.Library()

class FacebookScriptNode(template.Node):
        def render(self, context):
            return """
            <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>

            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

            <script type="text/javascript"> FB.init("%s", "%s");
                function facebook_onlogin() {
                    var uid = FB.Facebook.apiClient.get_session().uid;
                    var session_key = FB.Facebook.apiClient.get_session().session_key;
                    var expires = FB.Facebook.apiClient.get_session().expires;
                    var secret = FB.Facebook.apiClient.get_session().secret;
                    var sig = FB.Facebook.apiClient.get_session().sig;

                    fb_connect_ajax(expires, session_key, secret, uid, sig);

                }

                function fb_connect_ajax(expires, session_key, ss, user, sig) {

                    var post_string = 'expires=' + expires;
                    post_string = post_string + '&session_key=' + session_key;
                    post_string = post_string + '&ss=' + ss;
                    post_string = post_string + '&user=' + user;
                    post_string = post_string + '&sig=' + sig;

                    $.ajax({
                        type: "POST",
                        url: "%s",
                        data: post_string,
                        success: function(msg) {
                            window.location = '%s'; //.reload()
                        }
                    });
                } 
            </script>       
            """ % (settings.FACEBOOK_API_KEY, reverse('xd_receiver'), reverse('facebook_connect_ajax'), settings.LOGIN_REDIRECT_URL)


def facebook_connect_script(parser, token): return FacebookScriptNode()

register.tag(facebook_connect_script)

class FacebookLoginNode(template.Node):
    def render(self, context): 
        return "<fb:login-button onlogin='facebook_onlogin();'></fb:login-button>"

def facebook_connect_login_button(parser, token): return FacebookLoginNode()

register.tag(facebook_connect_login_button)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:55:09+00:00Added an answer on May 21, 2026 at 4:55 am

    Your facebookConnect.py file must be within your templatetags package (it must have an __init__.py to make it a package).

    It also appears that in your settings.INSTALLED_APPS setting, you’ve added facebookconnect, even though that isn’t an app (going by your directory structure). Instead, you should have universityDB.universityDetails listed as an app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement Facebook Connect on a website with .NET MVC using C#.
I'm trying to implement single sign-on using facebook in my ruby sinatra app. So
I was trying to implement facebook logout functionality for my django app. In my
I am trying to implement facebook Connect to my cakephp Application. i am using
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I am trying to implement AJAX in my Google App Engine application, and so
I am trying to implement share this method. I am using the code as
I am trying to implement Facebook into my Android app. Everytime though, the facebook
trying to implement a dialog-box style behaviour using a separate div section with all
I'm trying to implement something like this: <div> <table> <thead> <tr> <td>Port name</td> <td>Current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.