def bootstrap(): print(c.yellow('clean & update apt')) print(c.yellow('creating folders')) run('test -d %(webapps_root)s || mkdir %(webapps_root)s' % env) run('test -d %(log_path)s || mkdir -p %(log_path)s' % env) run('test -d %(ports_path)s || mkdir -p %(ports_path)s' % env) print(c.yellow('bootstrap python')) utils.python_bootstrap() print(c.yellow('installing git')) git.install() print(c.yellow('installing postgres')) postgres.install() if 'djcelery' in app.settings.INSTALLED_APPS and \ ('localhost' in getattr(app.settings, 'BROKER_URL', '')): apt.install('redis-server') print(c.yellow('installing extra packages')) apt.install('supervisor') apt.install(*env.specific_packages) print(c.yellow('installing nginx')) nginx.install() print(c.green('bootstrap complete')) postgres.configure() print(c.green('installing requirements')) django.install_requirements() if 'south' in app.settings.INSTALLED_APPS: django.migrate() print(c.yellow('compressing static files')) try: django.collectstatic() except: print(c.red('Collect static failed')) if getattr(app.settings, 'COMPRESS_OFFLINE', False): try: django.compress() except: print(c.red('Static compression failed'))
def refresh_database(): postgres.drop() postgres.configure()