See http://wiki.github.com/k7d/approcket/
You need to put rocket.py
somewhere into your application. E.g
mkdir lib
git sublodule add https://github.com/k7d/approcket.git lib/approcket
echo "import os.path" > lib/__init__.py
echo "import site" >> lib/__init__.py
echo "site.addsitedir(os.path.dirname(__file__))" >> lib/__init__.py
echo "./approcket" >> lib/submodules.pth
Then add it to your app.yaml
file, right after the line handlers:
- url: /rocket/.*
script: lib/approcket/rocket/handler.py
If you are on Python 2.7 try something like this:
- url: /rocket/.*
script: rocket.handler.application
Generate a secret key and add it to appengine_config.py
echo "approcket_SECRET_KEY = '`dd if=/dev/urandom count=2000 | shasum | cut -d ' ' -f 1 | tail -n 1`'" >> appengine_config.py
Now your application is ready to deploy.
If you want to make absolutely sure that no external process modifies your datastore set approcket_READONLY = True
in appengine_config.py
.
Your models need an automatically timestamped files like this:
timestamp = db.DateTimeProperty(auto_now=True, indexed=True)
If you have created the field with indexed=False
approcket can not work.
Execute something like this on your database server:
(cd $BASEDIR/approcket_industrial/rocket ; \
./replicator.py \
--database_name=mydb \
--database_user=mydbuser \
--database_password=ph7etaXii5Ajek8a \
--rocketurl=http://myapp.appspot.com/rocket \
-s 4eabfa74e5d1c9c47e961156f0517205b4486b74 )
The fantatic approcket was originaly concived by Kaspars Dancis and published on github. approcket_industrial
is a fork removing features and adding robustness and code which is easier to audit. approcket_industrial
saves resources by using datastore cursors. It ensures that data only flows in a single direction (from AppEngine to mySQL) and can handle characters illegal in XML. It also ensures keymaterial is kept out of version control.