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()
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")
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)
def createsuperuser(): username = raw_input("Enter name for new super user: "******"createsuperuser %s" % username)