Table of Contents
Python/Django
The Python library is provided by the PyFacebook client implementation from and you will need to install it /opt/local/lib/python2.4/site-packages/facebook from a straight SVN checkout (svn checkout http://pyfacebook.googlecode.com/svn/trunk/ pyfacebook).
Preflight
- Facebook Developer http://www.facebook.com/developers/apps.php
The MySQLdb which comes with stable release of pkgsrc is out of date. Please follow these instructions for building the current version.
Installation
- Configure your Facebook application to point to http://xxxxxxxx.fb.joyent.us/mysite/
- SFTP as xxxxxxxx@xxxxxxxx.fb.joyent.us into your accelerator.
- Place your python application into
/home/xxxxxxxx/myapps
mod_python & Memcache
From Virtualmin
- In a browser log into https://xxxxxxxx.fb.joyent.us:10000/ as admin
- Select Webmin below Joyent Accelerator
- From the left-hand navigation select Server
- Select Apache Webserver
- From the right side select the Global configuration tab
- Select the Edit Config Files icon
- Select the /opt/local/etc/httpd/includes/dso.cfg file from the combobox
- Select the Edit Directives in File: pushbutton
- Look for the line
#LoadModule python_module lib/httpd/mod_python.so
and change to
LoadModule python_module lib/httpd/mod_python.so
- select Save
- From the right side select the Existing Virtual Hosts tab
- Select the Virtual Server for your django application xxxxxxxx.fb.joyent.us
- Select the Edit Directives icon
- Add your handler something like shown below:
<Location "/mysite/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On PythonPath "['/home/xxxxxxx/myapps'] + sys.path" </Location>
- Select the Save pushbutton
- From the upper right select Apply changes to restart apache
- From the left-hand navigation select System
- Select Service Management Facility
- Select Include Disabled Services at the top
- Check memcached
- Select Enable pushbutton at the top and to the right of Apply to Checked Items
From SSH
- From your local machine,
ssh xxxxxxxx@xxxxxxxx.fb.joyent.us
sudo nano /opt/local/etc/httpd/includes/dso.conf
- change
#LoadModule python_module lib/httpd/mod_python.so
- to
LoadModule python_module lib/httpd/mod_python.so
- Add your python handler code
sudo nano /opt/local/etc/httpd/virtualhosts/xxxxxxxx.conf
which will look something like this:
<Location "/mysite/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On PythonPath "['/home/xxxxxxx/myapps'] + sys.path" </Location>
- restart apache
sudo svcadm restart apache
- enable memcache
sudo svcadm enable memcached
- Check that everything started correctly nothing should be listed from this command:
svcs -x