How to pass env variable within django app to digitalocean droplet

Hi there, I have deployed a django app using this tutorial:

Now i want to create env variables for secret keys and api tokens. The problems is, i deploy my app through github and if i add .env to gitignore it will not be pulled to the droplet. And if i dont add gitignore, the will no point to create .env

So how can i pass .env file to droplet through github (I want to make the repo public)

Thank you in advance :)

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 26, 2022

Hi there,

You could add your environment variables as secrets to your GitHub repository and then pass them over to your GitHub actions as described here in the docs:

That way you will not have to commit your secrets directly.

Let me know how it goes!