Falcon-REST-API-Pattern icon indicating copy to clipboard operation
Falcon-REST-API-Pattern copied to clipboard

How do I read environment variables and stop gunicorn if not found

Open ayushidalmia opened this issue 8 years ago • 1 comments

Currently I am doing the following:

path = os.environ.get('DATABASE_PATH')
if path==None:
    print "SET DATABASE_PATH, using --env key=value"   
    sys.exit()

api = falcon.API(middleware=[cors.middleware])

And when I run, I run as follows: gunicorn app:api --env "DATABASE_PATH=some path"

However, if I don't give the path, the gunicorn server does not stop on it's own but keeps running like the following:

screen shot 2016-08-31 at 8 21 02 pm

How do I stop the server?

ayushidalmia avatar Aug 31 '16 14:08 ayushidalmia

it may help

  1. to exit process----clt+z
  2. to see how many server is running------ ps -ef|grep "gunicorn"
  3. then to kill the server-----sudo kill -9 2303 (server-2303 )

rupak-technicise avatar May 09 '17 10:05 rupak-technicise