Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if your app is running on local Python Development Server?

I need to programatically determine if my app is running in development or not, so that I can provide sandbox values for a variety of constants and methods.

Something like:

if app.development: # Live mode
  FREEBASE_USER = "spam123"
  FREEBASE_PSWD = "eggs123"
  FREEBASE = freebase

else: # Sandbox mode
  FREEBASE_USER = "spam"
  FREEBASE_PSWD = "eggs"
  FREEBASE = freebase.sandbox
like image 572
Will Curran Avatar asked May 06 '11 17:05

Will Curran


1 Answers

import os

DEV = os.environ['SERVER_SOFTWARE'].startswith('Development')
like image 51
Drew Sears Avatar answered Sep 20 '22 08:09

Drew Sears