def runserver(): with virtualenv(): run( 'python manage.py runserver [::]:8000 --settings={}'.format( env.settings_file ) )
def createsuperuser(): with virtualenv(): run( 'python manage.py createsuperuser --settings={}'.format( env.settings_file ) )
def syncdb(): with virtualenv(): run( 'python manage.py syncdb --noinput --settings={}'.format( env.settings_file ) )
def collectstatic(): with virtualenv(): run( 'python manage.py collectstatic --settings={}'.format( env.settings_file ) )
def schemamigration(): initial = '' _verify_migration_app_is_set() _verify_migration_initial_is_set() app = env.schemamigration_app initial = '--initial' if env.schemamigration_initial == 'y' else '' with virtualenv(): run('python manage.py schemamigration {initial} {app} --settings={settings}'.format(initial=initial, app=app, settings=env.settings_file))
def migrate(): # if app == '', south will look for all migrations in all apps verify_migration_app_is_set() with virtualenv(): run( 'python manage.py migrate {} --settings={}'.format( env.schemamigration_app, env.settings_file, ) )
def schemamigration(): initial = '' verify_migration_app_is_set() verify_migration_initial_is_set() app = env.schemamigration_app initial = '--initial' if env.schemamigration_initial == 'y' else '--auto' with virtualenv(): run( 'python manage.py schemamigration {} {} --settings={}'.format( initial, app, env.settings_file ) )
def start(): with virtualenv(): run("celery -A {} worker -l info".format(env.name))
def restart_celery(): with virtualenv(): sudo('{}/bin/supervisorctl restart celery'.format(env.virtualenv))
def collectstatic(): _verify_aws_keys_are_set() require('aws_access_key_id', 'aws_secret_access_key') with virtualenv(): run('python manage.py collectstatic --settings={}'.format(env.settings_file))
def django_shell(): with virtualenv(): run('python manage.py shell --settings={}'.format(env.settings_file))
def startwsgi(): with virtualenv(): args = '-w 9 -k gevent --max-requests 250 --preload --pid={}'.format( PID_PATH ) run('python manage.py run_gunicorn 0.0.0.0:8000 --settings={} {}'.format(env.settings_file, args))