Exemplo n.º 1
0
def deploy_project():
    "Deploy the project."
    if not exists(env.deploy_root):
        # Create project's directory structure
        sudo("mkdir -p %(deploy_root)s" % env)
        with cd(env.deploy_root):
            sudo("mkdir -p conf db logs site_media/static site_media/media")
        # Set permissions
        # TODO: Need to make sure this user exists before assigning them permissions
        # This is so that a user can install things to their virtualenv without sudo
        # It isn't needed yet, so leaving it out for now.
        #sudo("chown -R %(project_name)s:%(project_name)s /srv/virtualenvs/%(project_name)s" % env)
        sudo("chown -R www-data %(deploy_root)s/db" % env)
        sudo("chown -R www-data %(deploy_root)s/site_media" % env)
    if not exists(env.virtualenv_dir):
        sudo("mkvirtualenv %(project_name)s" % env)
    if not exists("/etc/apache2/sites-available/%(project_name)s" % env):
        upload_apache_config()
    disable_project()
    upload_project()
    disable_debug()
    install_project_requirements()
    collect_static_media()
    manage("syncdb --noinput")
    enable_project()
Exemplo n.º 2
0
def deploy_project():
    "Deploy the project."
    if not exists(env.deploy_root):
        # Create project's directory structure
        sudo("mkdir -p %(deploy_root)s" % env)
        with cd(env.deploy_root):
            sudo("mkdir -p conf db logs site_media/static site_media/media")
        # Set permissions
        # TODO: Need to make sure this user exists before assigning them permissions
        # This is so that a user can install things to their virtualenv without sudo
        # It isn't needed yet, so leaving it out for now.
        #sudo("chown -R %(project_name)s:%(project_name)s /srv/virtualenvs/%(project_name)s" % env)
        sudo("chown -R www-data %(deploy_root)s/db" % env)
        sudo("chown -R www-data %(deploy_root)s/site_media" % env)
    if not exists(env.virtualenv_dir):
        sudo("mkvirtualenv %(project_name)s" % env)
    if not exists("/etc/apache2/sites-available/%(project_name)s" % env):
        upload_apache_config()
    disable_project()
    upload_project()
    disable_debug()
    install_project_requirements()
    collect_static_media()
    manage("syncdb --noinput")
    enable_project()
Exemplo n.º 3
0
def sync_and_migrate():
    """
    Runs Django's syncdb management command (without taking user input)
    and then
    """
    manage("syncdb --noinput")
    if env.uses_south:
        manage("migrate")
Exemplo n.º 4
0
def collect_static_media():
    "Collect the static media for the project."
    # Purge the old before building the new
    sudo("rm -rf %(deploy_root)s/site_media/static/*" % env)
    manage("collectstatic --noinput")
    sudo("chown -R www-data %(deploy_root)s/site_media" % env)
Exemplo n.º 5
0
def createsuperuser():
    username = raw_input("Enter name for new super user: "******"createsuperuser %s" % username)
Exemplo n.º 6
0
def collect_static_media():
    "Collect the static media for the project."
    # Purge the old before building the new
    sudo("rm -rf %(deploy_root)s/site_media/static/*" % env)
    manage("collectstatic --noinput")
    sudo("chown -R www-data %(deploy_root)s/site_media" % env)
Exemplo n.º 7
0
def createsuperuser():
    username = raw_input("Enter name for new super user: "******"createsuperuser %s" % username)