title: Django Gunicorn wsgi
body: <p>Hi I am trying to integrate my django 1.4.1 app with Gunicorn 0.14.6. I start gunicorn server from command line like so - </p>
  
  <pre><code>gunicorn -c /home/code/gunicorn_config.py
  </code></pre>
  
  <p>I get this traceback - </p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 459, in spawn_worker
      worker.init_process()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 99, in init_process
      self.wsgi = self.app.wsgi()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 101, in wsgi
      self.callable = self.load()
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 24, in load
      return util.import_app(self.app_uri)
    File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 292, in import_app
      app = eval(obj, mod.__dict__)
    File "&lt;string&gt;", line 1, in &lt;module&gt;
  NameError: name 'application' is not defined
  </code></pre>
  
  <p>Where am i going wrong? Whats this <code>application</code> variable &amp; where do I need to modify this?</p>
  
  <p>Also since I am using Django1.4.1 I have a <code>wsgi.py</code> file already in my project, do I need to change that? </p>
  
  <p><strong>UPDATE:</strong> here is my <code>gunicorn_config.py</code> file contents - </p>
  
  <pre><code>import os
  import sys
  import multiprocessing
  
  def app_path():
      sys.path.append('/home/code/po/')
      sys.path.append('/home/code/po/ball/')
      return
  
  def num_cpus():
      cpus = 0
      try:
          cpus = os.sysconf("SC_NPROCESSORS_ONLN")
      except:
          cpus =  multiprocessing.cpu_count()
  
      if cpus: return cpus
      else: return 3
  
  #defining the behavior of gunicorn
  app_path()
  
  bind      = "127.0.0.1:8080"
  workers   = num_cpus()*2 + 1
  debug     = True
  daemon    = False
  accesslog = '/home/code/logs/guni_access.log'
  errorlog  = '/home/code/logs/guni_error.log'
  loglevel  = 'debug'
  django_settings  = '/home/code/po/po/'
  pythonpath       = '/home/code/po/'
  </code></pre>
  
  <p>@moopet - i dont even think that <code>wsgi.py</code> file is called, how do i make gunicorn pick that file ?</p>