예제 #1
0
def build_static(venv_path):
    frequire('DJANGO_SETTINGS_MODULE', provided_by=('vagrant',))
    activate_cmd = 'source %s' % join(venv_path, 'bin/activate')
    collect_cmd = 'python manage.py collectstatic --noinput --clear --settings=%s' % env['DJANGO_SETTINGS_MODULE']
    with cd(DJANGO_DIR):
        sudo('%s && %s' % (activate_cmd, collect_cmd), user=SITE_USER)
    sudo('chmod -R a+rx %s' % join(SITE_DIR, 'site_media'))
예제 #2
0
def build_static(venv_path):
    frequire('DJANGO_SETTINGS_MODULE', provided_by=('vagrant', ))
    activate_cmd = 'source %s' % join(venv_path, 'bin/activate')
    collect_cmd = 'python manage.py collectstatic --noinput --clear --settings=%s' % env[
        'DJANGO_SETTINGS_MODULE']
    with cd(DJANGO_DIR):
        sudo('%s && %s' % (activate_cmd, collect_cmd), user=SITE_USER)
    sudo('chmod -R a+rx %s' % join(SITE_DIR, 'site_media'))
예제 #3
0
def deploy_nginx():
    frequire('SERVER_NAME', provided_by=('vagrant',))
    upload_template('site.conf.j2', 
                    '/etc/nginx/sites-available/%s' % SITE_NAME,
                    context={
                        'nginx_server_name': env['SERVER_NAME'],
                        'site_dir': SITE_DIR,
                        'static_dir': join(SITE_DIR, 'site_media', 'static'),
                        'static_parent_dir': join(SITE_DIR, 'site_media'),
                        'gunicorn_port': '8001',
                    },
                    template_dir=TEMPLATE_DIR,
                    use_jinja=True,
                    use_sudo=True,
                    )
    nginx.enabled(SITE_NAME)
    nginx.disabled('default')
예제 #4
0
def deploy_nginx():
    frequire('SERVER_NAME', provided_by=('vagrant', ))
    upload_template(
        'site.conf.j2',
        '/etc/nginx/sites-available/%s' % SITE_NAME,
        context={
            'nginx_server_name': env['SERVER_NAME'],
            'site_dir': SITE_DIR,
            'static_dir': join(SITE_DIR, 'site_media', 'static'),
            'static_parent_dir': join(SITE_DIR, 'site_media'),
            'gunicorn_port': '8001',
        },
        template_dir=TEMPLATE_DIR,
        use_jinja=True,
        use_sudo=True,
    )
    nginx.enabled(SITE_NAME)
    nginx.disabled('default')
예제 #5
0
def put_runserver(venv):
    frequire('DJANGO_SETTINGS_MODULE', provided_by=('vagrant',))
    destination_file = join(SITE_DIR, 'bin', 'runserver.sh')
    upload_template('runserver.sh.j2',
                    destination_file,
                    context={
                        'settings_module': env['DJANGO_SETTINGS_MODULE'],
                        'venv_dir': venv,
                        'site_user': SITE_USER,
                        'site_group': SITE_USER,
                        'log_level': 'info',
                        'site_dir': join(CLONE_DIR, 'bugtracker'),
                        'wsgi_module': 'bugtracker.wsgi',
                        'repo_dir': CLONE_DIR,
                        'gunicorn_port': '8001',
                    },
                    template_dir=TEMPLATE_DIR,
                    use_jinja=True,
                    use_sudo=True,
                    chown=True,
                    user=SITE_USER)
    sudo('chmod +x %s' % destination_file)
예제 #6
0
def put_runserver(venv):
    frequire('DJANGO_SETTINGS_MODULE', provided_by=('vagrant', ))
    destination_file = join(SITE_DIR, 'bin', 'runserver.sh')
    upload_template('runserver.sh.j2',
                    destination_file,
                    context={
                        'settings_module': env['DJANGO_SETTINGS_MODULE'],
                        'venv_dir': venv,
                        'site_user': SITE_USER,
                        'site_group': SITE_USER,
                        'log_level': 'info',
                        'site_dir': join(CLONE_DIR, 'bugtracker'),
                        'wsgi_module': 'bugtracker.wsgi',
                        'repo_dir': CLONE_DIR,
                        'gunicorn_port': '8001',
                    },
                    template_dir=TEMPLATE_DIR,
                    use_jinja=True,
                    use_sudo=True,
                    chown=True,
                    user=SITE_USER)
    sudo('chmod +x %s' % destination_file)