diff --git a/.travis.yml b/.travis.yml index 08f8764..16f6f91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,9 @@ cache: pip python: - '3.6' install: +- pip install --upgrade pip - pip install -r requirements.dev.txt +- pip install --upgrade pytest - pip install coveralls - pip install -e . script: APP_SECRET_KEY=a pytest diff --git a/pygameweb/__init__.py b/pygameweb/__init__.py index a2d55b5..e7cd19c 100644 --- a/pygameweb/__init__.py +++ b/pygameweb/__init__.py @@ -3,29 +3,6 @@ # So we can use environment variables to configure things. -def load_into_environ(fname): - """ load the key value pairs in fname into the os.environ. +from dotenv import load_dotenv +load_dotenv() - Each line should have a key=value pair. - There can be comments with #. - - :param fname: name of the '.env' file. - """ - import os - - def as_key_value(lines): - """ Return a dict of the key value pairs. - """ - no_comments = [l.split('#')[0].rstrip() for l in lines if not l.startswith('#')] - no_empty = [l for l in no_comments if l] - kvs = [l.split('=') for l in no_empty] - no_extra_spaces = [(k.rstrip().lstrip(), v.rstrip().lstrip()) for k, v in kvs] - return no_extra_spaces - - if os.path.exists(fname): - with open(fname) as lines: - for key, value in as_key_value(lines): - if key not in os.environ: - os.environ[key] = value - -load_into_environ('.env') diff --git a/requirements.txt b/requirements.txt index 9915923..761d79b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,7 @@ ghdiff numpy pandas psycopg2 +python-dotenv pyquery pygments pq