def make_default_env(cfg):
    if cfg.django_settings:
        os.environ['DJANGO_SETTINGS_MODULE'] = cfg.django_settings

    if cfg.pythonpath and cfg.pythonpath is not None:
        paths = cfg.pythonpath.split(",")
        for path in paths:
            pythonpath = os.path.abspath(cfg.pythonpath)
            if pythonpath not in sys.path:
                sys.path.insert(0, pythonpath)

    try:
        os.environ['DJANGO_SETTINGS_MODULE']
    except KeyError:
        # not settings env set, try to build one.
        cwd = util.getcwd()
        project_path, settings_name = find_settings_module(cwd)

        if not project_path:
            raise RuntimeError("django project not found")

        pythonpath, project_name = os.path.split(project_path)
        os.environ['DJANGO_SETTINGS_MODULE'] = "%s.%s" % (project_name,
                settings_name)
        if pythonpath not in sys.path:
            sys.path.insert(0, pythonpath)

        if project_path not in sys.path:
            sys.path.insert(0, project_path)
dataset/ETHPy150Open RoseOu/flasky/venv/lib/python2.7/site-packages/gunicorn/app/djangoapp.py/make_default_env/original