Skip to content

Commit efe623f

Browse files
author
Saurabh Kumar
committed
setup: add coverage badge to readme [ci skip]
1 parent bc567e6 commit efe623f

File tree

1 file changed

+30
-40
lines changed

1 file changed

+30
-40
lines changed

README.md

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# python-dotenv
22

3-
[![Build Status](https://travis-ci.org/theskumar/python-dotenv.svg?branch=master)](https://travis-ci.org/theskumar/python-dotenv) [![PyPI version](https://badge.fury.io/py/python-dotenv.svg)](http://badge.fury.io/py/python-dotenv) [![Downloads](https://pypip.in/download/python-dotenv/badge.svg)](https://pypi.python.org/pypi/python-dotenv/)
3+
[![Build Status](https://travis-ci.org/theskumar/python-dotenv.svg?branch=master)](https://travis-ci.org/theskumar/python-dotenv) [![Coverage Status](https://coveralls.io/repos/theskumar/python-dotenv/badge.svg?branch=master)](https://coveralls.io/r/theskumar/python-dotenv?branch=master) [![PyPI version](https://badge.fury.io/py/python-dotenv.svg)](http://badge.fury.io/py/python-dotenv) [![Downloads](https://pypip.in/download/python-dotenv/badge.svg)](https://pypi.python.org/pypi/python-dotenv/)
44

55
# Features
66

7-
The original work is based on [django-dotenv](https://github.com/jacobian/django-dotenv) by jacobian.
7+
The original work is based on [django-dotenv](https://github.com/jacobian/django-dotenv) by jacobian.
88

99
- read values from .env file and loads them as environment variable.
10-
- use it any python project not just django.
10+
- use it any python project not just django.
1111
- commandline interface to read/write `.env` file on your local and remote servers.
12+
- python 2 and 3 support
1213

1314

1415
# Installation
@@ -19,23 +20,35 @@ pip install python-dotenv --upgrade
1920

2021
# Usage
2122

22-
## Format
23-
You define your environment variables with a simple key=value list.
23+
## Loading variables from a `.env` file into your python project
2424

25-
<pre>
26-
SECRET_KEY="your_secret_key"
27-
DATABASE_PASSWORD="your_database_password"
28-
...
29-
</pre>
25+
### Any Python Project
26+
27+
Add the following line at the start of the file, from your program starts:
28+
29+
```python
30+
import dotenv
31+
dotenv.load_dotenv("/path/to/.env")
32+
```
33+
34+
### Django
35+
36+
If you are using django you should add the above loader script at the top of `settings.py` and `manage.py`.
37+
38+
NOTE: If you use [django-configurations], support for reading `.env` file is coming soon[1]!
39+
40+
[1] https://github.com/jezdez/django-configurations/commit/01e3f5837f3d0fed215d
41+
42+
[django-configurations]: https://github.com/jezdez/django-configurations
43+
44+
45+
## Format of `.env` file
3046

31-
When using django-configurations, the environment variables have a default
32-
preposition DJANGO_ .
33-
This is only true for **default configuration**, which you can overwrite
34-
with *environ_prefix* and *environ_name* parameters.
47+
`.env` is a simple text file. With each environment variables listed per line, in the format of `KEY="Value"`
3548

3649
<pre>
37-
DJANGO_SECRET_KEY="your_secret_key"
38-
DJANGO_DATABASE_PASSWORD="your_database_password"
50+
SECRET_KEY="your_secret_key"
51+
DATABASE_PASSWORD="your_database_password"
3952
...
4053
</pre>
4154

@@ -59,36 +72,13 @@ Commands:
5972
unset Removes the given key.
6073
</pre>
6174

62-
## Loading variables from a `.env` file into your python project
63-
64-
### Any Python Project
65-
66-
Add the following line at the start of the file, from your program starts:
67-
68-
```python
69-
import dotenv
70-
DOTENV_PATH = "/path/to/.env"
71-
dotenv.load_dotenv(DOTENV_PATH)
72-
```
73-
74-
### Django
75-
76-
If you are using django you should add the above loader script at the top of `settings.py` and `manage.py`.
77-
78-
NOTE: If you use [django-configurations], support for reading `.env` file is coming soon[1]!
79-
80-
[1] https://github.com/jezdez/django-configurations/commit/01e3f5837f3d0fed215d
81-
82-
[django-configurations]: https://github.com/jezdez/django-configurations
83-
84-
8575
## Setting config on remote servers
8676

8777
We make use of excellent [Fabric] to acomplish this. Add a config task to your local fabfile, `dotenv_path` is the location of the absolute path of `.env` file on the remote server.
8878

8979
[Fabric]: http://www.fabfile.org/
9080

91-
```
81+
```python
9282
# fabfile.py
9383

9484
from fabric.api import task, run, env

0 commit comments

Comments
 (0)