Exemple #1
0
import os

from django.contrib.auth import get_user_model
from fabric.context_managers import cd
from fabric.contrib import django
from fabric.decorators import task
from fabric.operations import env, local, run
from fabric.utils import puts

BASE_DIR = os.path.dirname(os.path.realpath(__file__))
django.settings_module('test_app_1.settings')

django.setup()

ADMIN_EMAIL_ADDRESS = '*****@*****.**'

env.project_name = 'test_app_1'
env.project_root_dir = os.path.dirname(os.path.abspath(__file__))

env.project_src_dir = '{project_root_dir}/{project_name}'.format(**env)


@task
def pipenv_requirements():
    """
    Update the requirements using global pipenv.
    """
    with cd(env.project_src_dir):
        run('pipenv install')

Exemple #2
0
from django.core.management import call_command


from fab_settings import env
from fabric.contrib import django
from fabric.api import local, settings, hide, lcd
from fabric.tasks import Task
from tempfile import NamedTemporaryFile


sys.path.append(os.path.dirname(__file__) + '/../../mysite/')

django.settings_module('mysite.settings')
from django.conf import settings as dj_settings
import django
django.setup()


class BaseTask(Task):
    """
    Base class for all DB tasks.
    """
    db_cfg = dj_settings.DATABASES['default']
    engine = db_cfg.get('ENGINE').split('.')[-1]
    base_path = os.path.dirname(__file__) + '/../..'
    backup_path = None
    port = None
    host = None
    user = None
    name = None
    password = None