-
Install redis on OSX (10.7) Lion I used:
$ brew install redis
-
In the project and virtualenv I wanted to use django-celery in I installed the following.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a simple example of WebSocket + Tornado + Redis Pub/Sub usage. | |
Do not forget to replace YOURSERVER by the correct value. | |
Keep in mind that you need the *very latest* version of your web browser. | |
You also need to add Jacob Kristhammar's websocket implementation to Tornado: | |
Grab it here: | |
http://gist.github.com/526746 | |
Or clone my fork of Tornado with websocket included: | |
http://github.com/pelletier/tornado | |
Oh and the Pub/Sub protocol is only available in Redis 2.0.0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function write($path, $content, $mode="w+") | |
{ if (file_exists($path) && !is_writeable($path)){ return false; } if ($fp = fopen($path, $mode)){ fwrite($fp, $content); fclose($fp); } else { return false; } return true; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Test Django instance" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
respawn limit 10 5 | |
exec /path/to/test/hello/script.sh | |
#!/bin/bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Celery for ReadTheDocs" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
#Send KILL after 20 seconds | |
kill timeout 20 | |
script | |
chdir /home/ubuntu/playground/tw | |
exec bin/python manage.py celeryd -B -c 4 -f /home/ubuntu/log/celery.log | |
end script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import xmlrpclib, pprint | |
class DrupalNode: | |
def __init__(self, title, body, ntype='article', uid=1, username ='admin'): | |
self.title = title | |
self.body = body | |
self.type = ntype |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# probably ripped off from somewhere on drupal.org | |
# requires the services module | |
import xmlrpclib | |
s = xmlrpclib.ServerProxy('http://localhost/services/xmlrpc') | |
class DrupalNode: | |
def __init__(self, title, body, path, ntype='page', uid=1, username='mmatienzo'): | |
self.title = title |
NewerOlder