aidanlister / django-facebook Goto Github PK
View Code? Open in Web Editor NEWIntegrate Facebook into your Django application.
Home Page: http://aidanlister.com/2010/11/better-integration-with-facebook-for-django/
License: MIT License
Integrate Facebook into your Django application.
Home Page: http://aidanlister.com/2010/11/better-integration-with-facebook-for-django/
License: MIT License
I used pip to install django-facebook. I have the following settings:
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_facebook.middleware.FacebookMiddleware',
):
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'feeds',
'login_feeds',
'readhistory',
'django_facebook',
)
I get this error when running the server:
ImproperlyConfigured: Module "django_facebook.middleware" does not define a "FacebookMiddleware" attribute/class
I also tried in shell:
windmaple@windmaple-VirtualBox:~/git/master$ ./manage.py shell
No handlers could be found for logger "django_facebook.models"
Python 2.7.5+ (default, Sep 19 2013, 13:49:51)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
from django_facebook import middleware
middleware.FacebookMiddleware
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'FacebookMiddleware'
What am I doing wrong?
I get this error
Error importing middleware django_facebook.middleware: "No module named facebook"
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django_facebook.middleware.FacebookMiddleware',
)
I notice that for a currently logged in facebook user, every request to the server (whether for an entire new page or just for a part of a page such as a gif), we trigger process_request in middleware.py. Because we:
This then authenticates the user in the backend and sets request.user = user. Upon a new GET request to the server, we recognize request.user = anonymous once again and repeat the process.
Is there a convenient way to avoid repeated calls to the authentication backend and save request.user = user per page load? I'd imagine I can set some extra session variable so that I don't repeatedly need to call the auth framework, but is there a better way to have the fact that the user is logged in via facebook and request.user persist?
Let me know if that doesn't make sense.
Pleas add a MANIFEST.in file that includes your templates dir. Otherwise the won't be installed when using python setup.py install!
You don't have any requirements specified, though you import facebook
in middleware.py. Which one is it?!
Hi,
I changed the FacebookMiddleware to call auth.login() method instead to set request.user with the user variable, because all time that the view is loaded the authenticate method is call again.
I hope helped :)
Hey,
could you please add a LICENSE file so it's obvious how one can use your project?
Cheers,
Pascal
When I follow your installation I got this error 'module' object has no attribute 'get_user_from_cookie' any help please?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.