mirror of
https://github.com/wassname/cookiecutter-data-science.git
synced 2026-07-06 05:14:54 +08:00
Deployed 7d8086e with MkDocs version: 0.15.3
This commit is contained in:
+7
-3
@@ -322,10 +322,14 @@ OTHER_VARIABLE=something
|
||||
<p>If you look at the stub script in <code>src/data/make_dataset.py</code>, it uses a package called <a href="https://github.com/theskumar/python-dotenv">python-dotenv</a> to load up all the entries in this file as environment variables so they are accessible with <code>os.environ.get</code>. Here's an example snippet adapted from the <code>python-dotenv</code> documentation:</p>
|
||||
<pre><code class="python"># src/data/dotenv_example.py
|
||||
from os.path import join, dirname
|
||||
from dotenv import load_dotenv
|
||||
from dotenv import load_dotenv, find_dotenv
|
||||
|
||||
dotenv_path = join(dirname(__file__), os.pardir, os.pardir, '.env') # up two levels to root folder
|
||||
# find .env automagically by walking up directories until it's found
|
||||
dotenv_path = find_dotenv()
|
||||
|
||||
# load up the entries as environment variables
|
||||
load_dotenv(dotenv_path)
|
||||
|
||||
database_url = os.environ.get("DATABASE_URL")
|
||||
other_variable = os.environ.get("OTHER_VARIABLE")
|
||||
</code></pre>
|
||||
@@ -399,5 +403,5 @@ other_variable = os.environ.get("OTHER_VARIABLE")
|
||||
|
||||
<!--
|
||||
MkDocs version : 0.15.3
|
||||
Build Date UTC : 2016-04-29 19:49:45.990621
|
||||
Build Date UTC : 2016-05-05 18:29:16.454115
|
||||
-->
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
<url>
|
||||
<loc>None/</loc>
|
||||
<lastmod>2016-04-29</lastmod>
|
||||
<lastmod>2016-05-05</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user