Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

Docker + Django + Better approach of passing N Environment variables during image build

I have a project in Django and I am building the image through docker and we have 30 environment variables in the jango application, we used environ module for maintaining env variables.

And we have simple docker file where we don't have volumes and we are using python manage.py collectstatic in docker file.

When docker image is building, we are getting error at the step of calling python manage.py collectstatic and this command is expecting all the 30 environment variables otherwise docker image build is failing.

And if we pass all variables in docker file using ARG it is working fine.

My question is what is best approach to pass 30 environment variables while running this python manage.py collectstatic ?. Instead of build-args

We followed the approach by taking all settings in one pyhon file and we are pointing that file in docker as ARG DJANGO_MODULE_SETTINGS = python_file.

But I am getting error as collectstatic unknown command and please look for python manage.py help.

Kindly advise.

question from:https://stackoverflow.com/questions/65837604/docker-django-better-approach-of-passing-n-environment-variables-during-imag

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...