title: Heroku: how to detect if foreman is running
body: <p>I am using eclipse to develop my Django project, and it will be deployed to Heroku. In order to detect if the app is running on Heroku, the <code>settings.py</code> is modified:</p>
  
  <pre><code>if 'DYNO' in os.environ:    # Is running on Heroku
      DEBUG = False
  else:
      DEBUG = True
  ...
  
  if DEBUG==True:
      DATABASES = {
          'default': {
              ... 
          }
      }
  else:    # For Heroku
      # Parse database configuration from $DATABASE_URL
      import dj_database_url
      DATABASES = {'default':dj_database_url.config()}
      # Honor the 'X-Forwarded-Proto' header for request.is_secure()
      SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  </code></pre>
  
  <p>Also modify <code>wsgi.py</code>:</p>
  
  <pre><code>from &lt;myApp&gt; import settings
  
  if settings.DEBUG==True:
      application = get_wsgi_application()
  else:    # For Heroku
      from dj_static import Cling
      application = Cling(get_wsgi_application())
  </code></pre>
  
  <p>The above modifications are to identify if the app is running locally with <code>runserver</code> or on Heroku. However, if I try to run <code>foreman start</code> instead of <code>runserver</code>, the settings in <code>wsgi.py</code> will not work since <code>foreman</code> also requires <code>Cling</code>.</p>
  
  <p>Is there a way that I can detect if the app is run by <code>foreman</code> so that I can make proper setting?</p>