Esempio n. 1
0
def remote(host='192.168.1.11', port=8000):
    """Run remove server."""
    ifconfig = subprocess.check_output('ifconfig')
    if host not in ifconfig.decode('utf-8'):
        return print_msg(f'Host {host} not in "ifconfig"', error=True)

    return manage(f'runserver {host}:{port}')
Esempio n. 2
0
def resetdb():
    """Reset database to initial state."""
    print_msg('Remove "scr/media" folder')
    local('rm -rf media/')

    print_msg('Reset database')
    manage('reset_db -c --noinput')

    migrate()
    createsuperuser()

    print_msg('Populate database?')
    answer = prompt('\n', default='yes')

    if answer.lower() in ('y', 'yes', 1):
        populate_db()
Esempio n. 3
0
def populate_db():
    """Populate database with dummy data."""
    print_msg('Start populating DB')
    manage('populate_db')
Esempio n. 4
0
def pep8(path='apps core'):
    """Check PEP8 errors."""
    print_msg('Checking PEP8 errors')
    return local('flake8 --config=.flake8 {}'.format(path))
Esempio n. 5
0
def isort():
    """Fix imports formatting."""
    print_msg('Running imports fix')
    local('isort apps core config')
Esempio n. 6
0
def createsuperuser(email='*****@*****.**'):
    """Create superuser with default credentials."""
    print_msg('Creating superuser')
    return manage('createsuperuser --username root --email {}'.format(email))
Esempio n. 7
0
def migrate():
    """Apply migrations to database."""
    print_msg('Applying migrations')
    manage('migrate')