Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support single quotes #5

Merged
merged 3 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ coverage.xml
docs/_build/djangovenv
djangovenv/*
.DS_Store

# DB
db.sqlite3
Empty file removed LICENSE.txt
Empty file.
4 changes: 2 additions & 2 deletions django_envie/workroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def parse_file(file_path):
try:
pyfile = open(file_path, 'r')
for setting in pyfile.readlines():
match = search("(\w+)\s=\s\"(.*?)\"", setting)
match = search("(\w+)\s=\s[\"|\'](.*?)[\"|\']", setting)
key, value = match.groups()
os.environ.update({key: value})
return True
Expand Down Expand Up @@ -72,7 +72,7 @@ def convertfiletovars():
elif Config.is_file(yamlfilepath):
FLAG_SUCCEED = Config.parse_file(yamlfilepath)
elif not Config.is_file(pyfilepath) and not Config.is_file(
yamlfilepath):
yamlfilepath):
FLAG_ERROR = True

if FLAG_ERROR:
Expand Down
6 changes: 6 additions & 0 deletions docs/02-formatting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ You can place the .env.py file outside of your django project folder to keep up
DB_USER = "homer_simpson"
DB_PASSWORD = "Close, but you're way off."

Single quotes are also allowed:

.. code-block:: python

DBNAME = 'sector_seven'

For a .env.yml file, you can specify your configuration in the following format::

.. code-block:: none
Expand Down
4 changes: 1 addition & 3 deletions docs/03-importing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It is easy to get started with this module.
First, install this module in your virtual environment or base python installation.

.. code-block:: none

pip install django_envie


Expand All @@ -28,5 +28,3 @@ Finally, you can access set environment variables by doing the following in your
.. code-block:: python

SECRET_KEY = os.getenv('SECRET_KEY')


2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ PyYAML==3.11
tox==2.1.1
virtualenv==13.1.2
wheel==0.24.0
Django==1.11.1
nose==1.3.7
3 changes: 1 addition & 2 deletions tests/runtests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, print_function, unicode_literals

import os
import sys
import nose
Expand All @@ -18,5 +16,6 @@ def start(argv=None):
nose.run_exit(argv=argv,
defaultTest=os.path.abspath(os.path.dirname(__file__)))


if __name__ == "__main__":
start(sys.argv)