Fetching contributors…
Cannot retrieve contributors at this time
51 lines (33 sloc) 1.26 KB
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
import functools
import os
from fabric.api import local as _local
NAME = os.path.basename(os.path.dirname(__file__))
ROOT = os.path.abspath(os.path.dirname(__file__))
os.environ['DJANGO_SETTINGS_MODULE'] = '%s-project.settings' % NAME
os.environ['PYTHONPATH'] = os.pathsep.join([ROOT,
os.path.join(ROOT, 'examples')])
_local = functools.partial(_local, capture=False)
def shell():
"""Start a Django shell with the test settings."""
_local(' shell')
def test():
"""Run the Waffle test suite."""
_local(' test')
def serve():
"""Start the Django dev server."""
_local(' runserver')
def syncdb():
"""Create a database for testing in the shell or server."""
_local(' syncdb')
def schema():
"""Create a schema migration for any changes."""
_local(' schemamigration waffle --auto')
def migrate():
"""Update a testing database with south."""
_local(' migrate')