Search code examples
pythonflaskgunicorn

Not able to access gunicorn env file for python deployment in linux


I am trying to deploy python app in my centos7 using flask and gunicorn. but i found that the app is not able to retrive variables from .env file.

It is working on my local vm. I am using gunicorn --bind 0.0.0.0:5000 app:app

pls help.


Solution

  • So, just configure a service file app.service in /etc/systemd/system and add EnvironmentFile=/path_to_env_file under [service] and start the service.

    For more info on configuring the env file in gunicorn service, you can see here.