Exemple #1
0
def load_data():
    """Load extra fixtures into the database.

    Requires the env keys:

        release_path -- remote path of the deployed app
        deployment_type -- app environment to set before loading the data (i.e.
                            which database should it be loaded into)
        virtualenv -- path to this app's virtualenv (required to grab the
                        correct Python executable)
        extra_fixtures -- a list of names of fixtures to load (empty by default)
    """
    require('release_path')
    require('deployment_type')
    require('virtualenv')
    if env.migrated or env.updated_db:
        for fixture in env.extra_fixtures:
            django_manage_run("loaddata %s" % fixture)
Exemple #2
0
def load_data():
    """Load extra fixtures into the database.

    Requires the env keys:

        release_path -- remote path of the deployed app
        deployment_type -- app environment to set before loading the data (i.e.
                            which database should it be loaded into)
        virtualenv -- path to this app's virtualenv (required to grab the
                        correct Python executable)
        extra_fixtures -- a list of names of fixtures to load (empty by default)
    """
    require('release_path')
    require('deployment_type')
    require('virtualenv')
    if env.migrated or env.updated_db:
        for fixture in env.extra_fixtures:
            django_manage_run("loaddata %s" % fixture)
Exemple #3
0
def update_db(deployed=False):
    """Update the database to the currently deployed version using syncdb. If
    the app wasn't deployed (e.g. we are redeploying the same version for some
    reason, this command will prompt the user to confirm that they want to
    update.

    Requires the env keys:

        release_path -- remote path of the deployed app
        deployment_type -- app environment to set before loading the data (i.e.
                            which database should it be loaded into)
        virtualenv -- path to this app's virtualenv (required to grab the
                        correct Python executable)
    """
    require('deployment_type')
    require('virtualenv')
    require('release_path')
    if deployed or confirm(yellow("Update database?"), default=True):
        django_manage_run("syncdb --noinput")
        env.updated_db = True
Exemple #4
0
def update_db(deployed=False):
    """Update the database to the currently deployed version using syncdb. If
    the app wasn't deployed (e.g. we are redeploying the same version for some
    reason, this command will prompt the user to confirm that they want to
    update.

    Requires the env keys:

        release_path -- remote path of the deployed app
        deployment_type -- app environment to set before loading the data (i.e.
                            which database should it be loaded into)
        virtualenv -- path to this app's virtualenv (required to grab the
                        correct Python executable)
    """
    require('deployment_type')
    require('virtualenv')
    require('release_path')
    if deployed or confirm(yellow("Update database?"), default=True):
        django_manage_run("syncdb --noinput")
        env.updated_db = True
Exemple #5
0
def sync_all_migrate_fake(deployed=False):
    """
    Sync all apps and fake the migration to the currently deployed version using South. If
    the app wasn't deployed (e.g. we are redeploying the same version for some
    reason, this command will prompt the user to confirm that they want to
    migrate.

    Requires the env keys:

        release_path -- remote path of the deployed app
        deployment_type -- app environment to set before loading the data (i.e.
                            which database should it be loaded into)
        virtualenv -- path to this app's virtualenv (required to grab the
                        correct Python executable)
    """
    require('release_path')
    require('deployment_type')
    require('virtualenv')
    if (env.migrate and
            (deployed or confirm(yellow("Fake migrate database?"), default=False))):
        django_manage_run("syncdb --all")
        django_manage_run("migrate --fake")
        env.migrated = True