22. Django 1.8 Server Build - CentOS 7 hosted on VPS - Facebook open graph API timeline fan page custom tab 1
Facebook Pages are a heavily used feature of Facebook. Major brands, celebrities, etc. use Facebook Pages as their "social home" on the web. One of the most interesting features of Apps on Facebook.com is the ability for your app to be used within the context of a Facebook Page. You can find an example of this kind of integration on the Coca-Cola Page's 'Coca-Cola store' tab.
Please visit Page Tab Tutorial for more
Tabs exist under Facebook cover photo and can be expanded by clicking on the 'More' drop-down arrow on the right. They're something like the website navigation for our Facebook Page, allowing visitors to browse all that our page has to offer.
CocaCola1.png
CocaCola2.png
To create a Facebook Graph API Timeline Fan Page Tab, we need to take the following steps:
- Create a Fan page which is a car club page for the tab live on.
- Then, we have to actually create a tab where the iframe from our servers going to live.
- And then, we have to create a Facebook app which would give us an App ID. It allows us to ask permission on to get to friends list from use so that we can post to Facebook Open Graph API from the user and send the info for the post to work.
We can think of our Facebook tab like an iFrame that loads inside Facebook. In other words, we can display pretty much whatever content we'd like inside our custom Facebook tab. we do this by creating a web page outside of Facebook. The contents of this page are what we'll tell Facebook to display within our custom tab.
Let's go to https://developers.facebook.com/apps. You'll be able to log in with your normal Facebook credentials.
AddANewApp.pngClick the green '+ Add a New App' button from the top right-hand corner. Then choose the 'Website' button at the far right.
AddANewAppWWW.pngInstead of using the "Quick Start" wizard that Facebook launches (which gets confusing), click on the 'Skip and Create App ID' button at the top right.
QuickStart.pngHere, we'll need to provide a Display Name for our "app" or "tab", will be displayed as on our Facebook Page. We can also create a namespace which is just a unique ID for our app. Since this is not a required field, and we can leave leave it blank. Select 'No' for the question about test versions. Then, choose Apps for Pages as the category, since we're creating this app as a custom tab for your Facebook Page.
CreateANewAppID.pngClick Create App ID, and we'll be taken to our App Dashboard for the next step.
Here is our App Dashboard.
CreateANewAppIDDashBoard.pngClick Settings in the left-hand navigation; then click the + Add Platform button to start configuring our Facebook Page tab.
CreateANewAppIDDashBoardSettings.pngWhen prompted, select Page Tab as our platform.
SelectPlatformPageTab.pngNext, add the Secure Page Tab URL of the external web page we created.
Note that Facebook requires a secure URL (which starts with https://), otherwise it won't work. Then, we may want a wide page tab (810px) so that our content fills the full width of the tab. We can leave Page Tab Edit URL field blank.
PageTabPlatform.pngClick the blue Save Changes button at the bottom right.
In order to add our new tab to our Page, we'll need to visit a link with several custom URL parameters. Here's the link we'll need to modify:
http://www.facebook.com/dialog/pagetab?app_id=APP_ID&next;=URL
App ID can be found in the basic settings for our app, and the URL is the Secure Page Tab URL.
So, our new URL would be:
http://www.facebook.com/dialog/pagetab?app_id=1625098564374792&next;=https://djangotest.sfvue.com/custom_facebook_tab/sfvueCars
One we have our URL, visit it in our browser, then we will have this:
sfvueURL.pngSelect the Facebook Page weant to add our tab to. Then click Add Page Tab. Keep in mind that we'll need to be an administrator of the Facebook Page in order to add the tab.
Now, our custom Facebook tab should now be added to our page. Let's go check and see!
When a Facebook user clicks on our custom tab, their browser sends a HTTP POST request to our tab's Secure Page Tab URL. They'll see "405 and 403 "Forbidden" error message if the page we're using to host the content of your Facebook tab forbids HTTP POST requests.
When we click the link sfvueCars, we get the following error.
ERR-CONNECTION-REFUSED.pngWe're going to work on this in subsequent Django tutorials.
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization
Django 1.8
Introduction - Install Django and Project Setup
Creating and Activating Models
Hello World A - urls & views
Hello World B - templates
Hello World C - url dispatcher
Hello World D - Models and SQLite Database
MVC - Hello World
Hello World on a Shared Host A
Hello World on a Shared Host B
Hello World - Admin Site Setup
virtualenv
Creating test project on virtualenv
Test project's settings.py
Creating Blog app and setting up models
Blog app - syncdb A
Blog app - syncdb B
Blog app - views and urls
Blog app - templates
Blog app - class based templates
Image upload sample code - local host
Authentication on Shared Host using FastCGI
User Registration on Shared Host A
User Registration with a Customized Form on Shared Host B
Blogs on Shared Host
Serving Django app with uWSGI and Nginx
Image upload sample code - shared host
Managing (Deploying) Static files (CSS, Images, Javascript) on Shared Host
Forum application on a Shared Host
Django Python Social Auth : Getting App ID (OAuth2) - Facebook, Twitter, and Google
Django: Python social auth, Facebook, Twitter, and Google Auth
Django: Python social auth, Facebook, Twitter, and Google Auth with Static files
...
Django 1.8 hosted on Linode VPS ==>
1. Setup CentOS 7 hosted on VPS
1B. Setup CentOS 7 hosted on VPS (multi-domain hosting setup) - Name server and Zone File settings (from GoDaddy to Linode)
2. ssh login and firewall
3. Apache Install
4. Install and Configure MariaDB Database server & PHP
5. Install and Configure Django
6. Model
7. Model 2 : populate tables, list_display, and search_fields
8. Model 3 (using shell)
9. Views (templates and css)
10. Views 2 (home page and more templates)
11. TinyMCE
12. TinyMCE 2
13. ImageField/FileField : Serving image/video files uploaded by a user
14. User Authentication 1 (register & forms)
15. User Authentication 2 (login / logout)
16. User Authentication 3 (password reset) - Sent from Email (gmail) setup etc.
17. User Authentication 4 (User profile & @login_required decorator)
18. User Authentication 5 (Facebook login)
19. User Authentication 6 (Google login)
20. User Authentication 7 (Twitter login)
21. User Authentication 8 (Facebook/Google/Twitter login buttons)
22. Facebook open graph API timeline fan page custom tab 1
23. Facebook Open Graph API Timeline Fan Page Custom Tab 2 (SSL certificate setup)
24. Facebook open graph API timeline fan page custom tab 3 (Django side - urls.py, settings.py, and views.py)
...
A sample production site Django 1.8.7: sfvue.com / einsteinish.com ==>
A sample production app (sfvue.com) with virtualenv and Apache
2. Upgrading to Django 1.8.7 sfvue.com site sample with virtualenv and Apache
(*) Django 1.8.7 einsteinish.com site - errors and fixes
Django 1.8.12 pytune.com site - local with Apache mod_wsgi
Django 1.8.12 pytune.com site - local with Nginx and uWSGI
Django 1.8.12 pytune.com site - deploy to AWS with Nginx and uWSGI
Django Haystack with Elasticsearch and Postgres
Django Compatibility Cheat Sheet
Python tutorial
Python Home
Introduction
Running Python Programs (os, sys, import)
Modules and IDLE (Import, Reload, exec)
Object Types - Numbers, Strings, and None
Strings - Escape Sequence, Raw String, and Slicing
Strings - Methods
Formatting Strings - expressions and method calls
Files and os.path
Traversing directories recursively
Subprocess Module
Regular Expressions with Python
Regular Expressions Cheat Sheet
Object Types - Lists
Object Types - Dictionaries and Tuples
Functions def, *args, **kargs
Functions lambda
Built-in Functions
map, filter, and reduce
Decorators
List Comprehension
Sets (union/intersection) and itertools - Jaccard coefficient and shingling to check plagiarism
Hashing (Hash tables and hashlib)
Dictionary Comprehension with zip
The yield keyword
Generator Functions and Expressions
generator.send() method
Iterators
Classes and Instances (__init__, __call__, etc.)
if__name__ == '__main__'
argparse
Exceptions
@static method vs class method
Private attributes and private methods
bits, bytes, bitstring, and constBitStream
json.dump(s) and json.load(s)
Python Object Serialization - pickle and json
Python Object Serialization - yaml and json
Priority queue and heap queue data structure
Graph data structure
Dijkstra's shortest path algorithm
Prim's spanning tree algorithm
Closure
Functional programming in Python
Remote running a local file using ssh
SQLite 3 - A. Connecting to DB, create/drop table, and insert data into a table
SQLite 3 - B. Selecting, updating and deleting data
MongoDB with PyMongo I - Installing MongoDB ...
Python HTTP Web Services - urllib, httplib2
Web scraping with Selenium for checking domain availability
REST API : Http Requests for Humans with Flask
Blog app with Tornado
Multithreading ...
Python Network Programming I - Basic Server / Client : A Basics
Python Network Programming I - Basic Server / Client : B File Transfer
Python Network Programming II - Chat Server / Client
Python Network Programming III - Echo Server using socketserver network framework
Python Network Programming IV - Asynchronous Request Handling : ThreadingMixIn and ForkingMixIn
Python Coding Questions I
Python Coding Questions II
Python Coding Questions III
Python Coding Questions IV
Python Coding Questions V
Python Coding Questions VI
Python Coding Questions VII
Python Coding Questions VIII
Python Coding Questions IX
Python Coding Questions X
Image processing with Python image library Pillow
Python and C++ with SIP
PyDev with Eclipse
Matplotlib
Redis with Python
NumPy array basics A
NumPy Matrix and Linear Algebra
Pandas with NumPy and Matplotlib
Celluar Automata
Batch gradient descent algorithm
Longest Common Substring Algorithm
Python Unit Test - TDD using unittest.TestCase class
Simple tool - Google page ranking by keywords
Google App Hello World
Google App webapp2 and WSGI
Uploading Google App Hello World
Python 2 vs Python 3
virtualenv and virtualenvwrapper
Uploading a big file to AWS S3 using boto module
Scheduled stopping and starting an AWS instance
Cloudera CDH5 - Scheduled stopping and starting services
Removing Cloud Files - Rackspace API with curl and subprocess
Checking if a process is running/hanging and stop/run a scheduled task on Windows
Apache Spark 1.3 with PySpark (Spark Python API) Shell
Apache Spark 1.2 Streaming
bottle 0.12.7 - Fast and simple WSGI-micro framework for small web-applications ...
Flask app with Apache WSGI on Ubuntu14/CentOS7 ...
Selenium WebDriver
Fabric - streamlining the use of SSH for application deployment
Ansible Quick Preview - Setting up web servers with Nginx, configure enviroments, and deploy an App
Neural Networks with backpropagation for XOR using one hidden layer
NLP - NLTK (Natural Language Toolkit) ...
RabbitMQ(Message broker server) and Celery(Task queue) ...
OpenCV3 and Matplotlib ...
Simple tool - Concatenating slides using FFmpeg ...
iPython - Signal Processing with NumPy
iPython and Jupyter - Install Jupyter, iPython Notebook, drawing with Matplotlib, and publishing it to Github
iPython and Jupyter Notebook with Embedded D3.js
Downloading YouTube videos using youtube-dl embedded with Python
Machine Learning : scikit-learn ...
Django 1.6/1.8 Web Framework ...