Joyent

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

The MySQLdb which comes with stable release of pkgsrc is out of date. Please follow these instructions for building the current version.

Installation

  1. SFTP as xxxxxxxx@xxxxxxxx.fb.joyent.us into your accelerator.
  2. Place your python application into /home/xxxxxxxx/myapps

mod_python & Memcache

From Virtualmin

  1. In a browser log into https://xxxxxxxx.fb.joyent.us:10000/ as admin
  2. Select Webmin below Joyent Accelerator
  3. From the left-hand navigation select Server
  4. Select Apache Webserver
  5. From the right side select the Global configuration tab
  6. Select the Edit Config Files icon
    1. Select the /opt/local/etc/httpd/includes/dso.cfg file from the combobox
    2. Select the Edit Directives in File: pushbutton
    3. Look for the line
      #LoadModule python_module lib/httpd/mod_python.so

      and change to

      LoadModule python_module lib/httpd/mod_python.so
    4. select Save
  7. From the right side select the Existing Virtual Hosts tab
  8. Select the Virtual Server for your django application xxxxxxxx.fb.joyent.us
  9. Select the Edit Directives icon
    1. 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>
    2. Select the Save pushbutton
  10. From the upper right select Apply changes to restart apache
  11. From the left-hand navigation select System
  12. Select Service Management Facility
  13. Select Include Disabled Services at the top
  14. Check memcached
  15. Select Enable pushbutton at the top and to the right of Apply to Checked Items

From SSH

  1. From your local machine,
    ssh xxxxxxxx@xxxxxxxx.fb.joyent.us
  2. sudo nano /opt/local/etc/httpd/includes/dso.conf 
    1. change
      #LoadModule python_module lib/httpd/mod_python.so
    2. to
      LoadModule python_module lib/httpd/mod_python.so
  3. 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>
  4. restart apache
    sudo svcadm restart apache
  5. enable memcache
    sudo svcadm enable memcached
  6. Check that everything started correctly nothing should be listed from this command:
    svcs -x
 
facebook/kb/django.txt · Last modified: 2007/12/03 21:16 by conradlee
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki