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

Convert from settings.py to an .env file #32

Open
picsldev opened this issue Apr 3, 2018 · 3 comments
Open

Convert from settings.py to an .env file #32

picsldev opened this issue Apr 3, 2018 · 3 comments

Comments

@picsldev
Copy link
Contributor

@picsldev picsldev commented Apr 3, 2018

pipenv reads the .env files automatically, loading the environment variables that we put into them.

It is a very powerful way to correctly configure an application, following the indications of "The Twelve-Factor App".

An example of a settings.py file converted to an .env file could be the following:

desarrollo@desarrollo:~/Proyectos/pipenv/blask$ cat .env

# Minimal conf for Blask
FLASK_APP=main.py

# Name of the Template Folder.
templateDir="templates"

# Name of the post Folder
postDir="posts"

# default name of the template file.
defaultLayout="template.html"

# Default name of the static Folder
staticDir="static"

# Title of the blog
tittle="Blask | A Simple Blog Engine Based on Flask"

All the environment variables that we want to define, can be included in the .env file.

.gitignore excludes the .env file so that it can not be versioned, so that we can store sensitive data inside it.

A very popular custom is to create a file .env.example, with sample data, so that other developers find it very easy to generate their own .env file from the .env.example file .

@zerasul

This comment has been minimized.

Copy link
Owner

@zerasul zerasul commented Apr 3, 2018

This can be a Good issue. Use enviorement variables instead a py file. Of course, there is another issue for use it with a Dictionary using a json file (#20). So i think we can use enviorement variables too.

@JuanjoSalvador

This comment has been minimized.

Copy link
Contributor

@JuanjoSalvador JuanjoSalvador commented Apr 3, 2018

Seems fixed on #31

@JuanjoSalvador

This comment has been minimized.

Copy link
Contributor

@JuanjoSalvador JuanjoSalvador commented Oct 10, 2018

Hey, how can we read this settings (from .env file) to use them on Blask?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.