Reference¶
Note
This is auto-generated API reference. Don’t expect much from it.
[source] links are most useful.
Warning
django-fab-deploy is still at early stages of development and API may change in future.
Django¶
- fab_deploy.django_commands.migrate(params='', do_backup=True)[source]¶
Runs migrate management command. Database backup is performed before migrations if do_backup=False is not passed.
- fab_deploy.django_commands.manage(*args, **kwargs)[source]¶
Runs django management command. Example:
fab manage:createsuperuser
- fab_deploy.django_commands.test(*args, **kwargs)[source]¶
Runs ‘runtests.sh’ script from project root. Example runtests.sh content:
#!/bin/sh default_tests='accounts forum firms blog' if [ $# -eq 0 ] then ./manage.py test $default_tests --settings=test_settings else ./manage.py test $* --settings=test_settings fi
Deployment¶
- fab_deploy.deploy.update_django_config(restart=True)[source]¶
Updates config.py on server (using config.server.py)
- fab_deploy.deploy.up(branch=None, before_restart=<function <lambda> at 0x3684758>)[source]¶
Runs vcs up or checkout command on server and reloads mod_wsgi process.
- fab_deploy.deploy.push(*args, **kwargs)[source]¶
Run it instead of your VCS push command.
The following strings are allowed as positional arguments:
- ‘notest’ - don’t run tests
- ‘syncdb’ - run syncdb before code reloading
- ‘migrate’ - run migrate before code reloading
- ‘pip_update’ - run virtualenv.pip_update before code reloading
- ‘norestart’ - do not reload source code
Keyword arguments:
- before_restart - callable to be executed after code uploading but before the web server reloads the code.
Customization example can be found here.
- fab_deploy.deploy.undeploy(confirm=True)[source]¶
Shuts site down. This command doesn’t clean everything, e.g. user data (database, backups) is preserved.
- fab_deploy.system.create_linux_account(*args, **kwargs)[source]¶
Creates linux account, setups ssh access and pip.conf file.
Example:
fab create_linux_account:"/home/kmike/.ssh/id_rsa.pub"
- fab_deploy.system.create_sudo_linux_account(*args, **kwargs)[source]¶
Creates linux account, setups ssh access and adds the created user to sudoers. This command requires root ssh access.
Virtualenv/pip¶
- fab_deploy.virtualenv.pip_install(*args, **kwargs)[source]¶
Installs pip requirements listed in <PIP_REQUIREMENTS_PATH>/<file>.txt file.
MySQL¶
- fab_deploy.mysql.mysql_execute(sql, user=None, password=None)[source]¶
Executes passed sql command using mysql shell.
- fab_deploy.mysql.mysql_create_db(db_name=None, db_user=None, root_password=None)[source]¶
Creates an empty mysql database.
Working with crontab¶
- fab_deploy.crontab.crontab_add(content, marker=None)[source]¶
Adds line to crontab. Line can be appended with special marker comment so it’ll be possible to reliably remove or update it later.