question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for .env file

See original GitHub issue

Requirement

Add support for .env file

Pre-requisite

Elementary knowledge of Python

Dependencies

None

Description

Typically, the part that’s given in config.py should actually be set as environment variables in a separate .env file. A sample file example.env is checked into git, whereas the .env file is gitignore-d. I think it’d be better to follow this practice and move away from config.py.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:22 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
chttrjeankrcommented, Mar 20, 2020

What is import dotenv?

This is a module in Python that can be looked up here. This is a really easy way of loading the environment variables from .env files and makes the code look a lot cleaner. To support this, requirements.txt needs to have another line appended.

1reaction
Varshney200commented, Mar 20, 2020

You need to add a template .env so that users can refer to it and create their own .env with their API keys and DB passwords ?

.env files are to be gitignored so should this template be a text file and the user should be asked to make changes into it and rename it as .env in their local repo?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is .env ? How to Set up and run a .env file in Node?
How to Set up and read a .env file ? The dotenv package for handling environment variables is the most popular option in...
Read more >
Customizing Node.js .env files - LogRocket Blog
Learn how to configure a Node.js application via environment variables and customize an .env file with new environment variables.
Read more >
Environment variables in Compose | Docker Documentation
If you have multiple environment variables, you can substitute them by adding them to a default environment variable file named .env or by...
Read more >
We need to talk about the .env | Platform.sh
env file. The site name, admin email address, and so on should either be in a read-only config file that is committed to...
Read more >
Adding Custom Environment Variables | Create React App
.env files should be checked into source control (with the exclusion of .env*.local ). What other .env files can be used?​. Note: this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found