S
S
Stanislav Shabalin2020-09-15 14:19:11
Python
Stanislav Shabalin, 2020-09-15 14:19:11

Environment variables in production?

Good afternoon.

For the first time I am trying to put the project correctly on the hoster's server and ran into a misunderstanding where to store my own variables so that they get into the virtual environment of the application or session.

On the local, I created a file in the root of the project .env and in the settings I get my variables from the environment. I also thought about hosting. Only the env with its contents must be configured before deploying the project from the git, and the local env must be registered in the gitignor.
But I saw the following on the forum and again doubted how it was right:


So how do you add .env to your server since it will be in .gitignore – Martins Jun 30 '19 at 0:35

@Martins Server should not be using .env, you should inject those environment variables directly (eg code deployment) – Aamir Adnan Jul 1 '19 at 2:50 pm


Develop my doubts, pliz, how to correctly understand this recommendation, which contradicts my ideas before. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2020-09-15
@Starck43

I add .env to gitignor and make env.skeleton (add to git) where I describe what should be in .env.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question