Using rmanage you can e.g. apply the following operations directly to your appfog database:
- syncdb
- south migrations
- dump and load fixtures
af tunnel myservice rmanage
where myservice is the service name on appfog (e.g. a mysql service)
This will launch a prompt e.g.
manage.py@af>
Enter help to display the commands Enter exit to leave the prompt
Examples:
# start the console
af tunnel myservice rmanage
# show all migrations
manage.py@af> migrate --list
# migrate a particular applications
manage.py@af> migrate myapp
# load a fixture
manage.py@af> loaddata myfixture.json
# run the django shell (using local code, remote database)
manage.py@af> shell
or run commands directly e.g. following af update
# one command at a time
echo migrate --list | af tunnel myservice rmanage
echo loaddata fixture.json | af tunnel myservice rmanage
# multiple commands from a file, one command per line
cat commands.rmanage | af tunnel myservice rmanage
create a file .af_clients in your home directory with the following content:
mysql:
rmanage: ${name} ${username} ${password} ${port}
Create the file settings_rmanage.py in your project's directory:
from settings import *
#
# settings are passed from af tunnel, order of parameters
# see .af_cliens in user home
#
DATABASES['default'] = {
'ENGINE': 'django.db.backends.mysql',
'NAME': sys.argv[1],
'USER': sys.argv[2],
'PASSWORD': sys.argv[3],
'HOST': '127.0.0.1', # default = localhost
'PORT': sys.argv[4] # default
}