Ejemplo n.º 1
0
def loaddata(path):
    """Load the specified JSON fixtures.  If preceded by a deployment target,
the fixture data will be loaded onto that target.  Otherwise they will be
loaded into the local datastore.

Arguments:

    :path -- The path to the fixture data to load

Usage:

    # Load data locally
    fab loaddata:groups/fixtures/test_groups.json

    # Load data onto staging
    fab staging loaddata:groups/fixtures/test_groups.json
"""
    import fixtures

    # Are we loading the fixtures remotely or locally?
    if hasattr(env, 'gae'):
        utils.prep_remote_shell()
    else:
        utils.prep_local_shell()

    # Actually load the fixtures (tweak the logging so their info shows up)
    logging.getLogger().setLevel(logging.INFO)
    fixtures.load_fixtures(path)
Ejemplo n.º 2
0
    def get(self):
        session = self.open_session()

        for collection_name in session.db.collection_names():
            session.db[collection_name].remove()

        load_fixtures()

        self.redirect('/admin/developer')
Ejemplo n.º 3
0
    def get(self):
        session = self.open_session()

        for collection_name in session.db.collection_names():
            session.db[collection_name].remove()

        load_fixtures()

        self.redirect('/admin/developer')
Ejemplo n.º 4
0
def bootup(sender, **kwargs):
    """
    After syncdb, bootup makes the required adjustements in order to prepare and secure the site
    """
    # only trigger if we have installed the last app
    if kwargs['app'].__name__ == '{0}.models'.format(settings.INSTALLED_APPS[-1]):

        # 1. load the fixtures
        load_fixtures()

        # 2. setup sites
        setup_sites()

        # 3. setup an admin account
        setup_superuser(
            username=getattr(settings, 'BOOTUP_SUPERUSER_NAME', ''),
            password=getattr(settings, 'BOOTUP_SUPERUSER_PASSWORD', ''),
            email=getattr(settings, 'BOOTUP_SUPERUSER_EMAIL', '')
         )
Ejemplo n.º 5
0
def loaddata(path):
    """Load the specified JSON fixtures.  If preceded by a deployment target,
the fixture data will be loaded onto that target.  Otherwise they will be
loaded into the local datastore.

Arguments:

    :path -- The path to the fixture data to load

Usage:

    # Load data locally
    fab loaddata:groups/fixtures/test_groups.json

    # Load data onto staging
    fab staging loaddata:groups/fixtures/test_groups.json
"""
    import fixtures
    logging.getLogger().setLevel(logging.INFO)
    fixtures.load_fixtures(path)
Ejemplo n.º 6
0
def load_fixtures():
    with app.app_context():
        fixtures.load_fixtures()