def setup_env():
    deploys = getattr(settings, "DEPLOYS", None)
    if not deploys:
        raise CommandError("DEPLOYS has not been defined in your project's settings.py file.")

    default = get_required_val(deploys, "default", "A default deployment has not been defined in your project's settings file.")

    domain  = get_required_val(default, "DOMAIN", "DOMAIN must be defined for your default deployment.")
    host    = get_required_val(default, "HOST", "HOST must be defined for your default deployment.")
    name    = get_required_val(default, "NAME", "NAME must be defined for your default deployment.")
    user    = get_required_val(default, "USER", "USER must be defined for your default deployment.")

    password = default.get("PASSWORD", None)
    branch = default.get("BRANCH", None) or "master"

    # Essentials
    env.project_domain = domain
    env.hosts = [ host ]
    env.host_string = host
    env.project_name = name
    env.user = user
    env.password = password
    env.project_branch = branch
    env.deploy_time = run("python -c 'import time; print time.strftime(\"%Y-%m-%d-%H-%M\");'")
    env.uses_south = settings.INSTALLED_APPS in "south"

    # Helpers
    env.deploy_root = os.path.join(PROJECTS_PATH, env.project_name)
    env.project_root = os.path.join(PROJECTS_PATH, env.project_name, env.project_name)
    env.virtualenv_dir = os.path.join(VIRTUALENVS_PATH, env.project_name)
dataset/ETHPy150Open typeish/django-deploy/django_deploy/utils.py/setup_env/swapped operands of `in`