title: Why does my Django app work locally, but not on Heroku?
body: <p><a href="https://github.com/MichelleGlauser/BookFairy" rel="nofollow">My Django app</a> works fine locally and sometimes the push to Heroku is successful, but the heroku logs show errors (and the app doesn't load online). It seems like there's something wrong with my Procfile (or perhaps my virtualenv, though I've re-done the whole thing to try to fix that).</p>
  
  <p>I've tried many versions of this in my Procfile:</p>
  
  <pre><code>web: python manage.py collectstatic --noinput; bin/gunicorn_django --workers=4 --bind=0.0.0.0:$PORT proj/prod_settings.py
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>web: python manage.py runserver 0.0.0.0:$PORT collectstatic --noinput
  --settings=proj/prod_settings.py
  </code></pre>
  
  <p>And this: </p>
  
  <pre><code>web: gunicorn bookfairy.wsgi.py
  </code></pre>
  
  <p>But I keep getting errors like these:</p>
  
  <pre><code>-foreman start pid 17199 result: no such option: --noinput
  
  -foreman start pid 17229 result: no such option: --workers
  
  -foreman start pid 17299 result: Could not import settings 'proj/prod_settings.py' (Is it on sys.path?): Import by filename is not supported.
  -Push failed: slug archive could not be created
  ! [remote rejected] master -&gt; master (pre-receive hook declined)
  error: failed to push some refs to heroku
  -foreman start pid 16943 result: Error: Usage is runserver [optional port number, or ipaddr:port]
  -Process exited with status 1
  State changed from starting to crashed
  -heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/robots.txt     host=bookfairy.herokuapp.com fwd="66.249.72.200" dyno= connect= service= status=503 bytes=
  -heroku[router]: at=error code=H14 desc="No web processes running" method=GET path=/robots.txt host=bookfairy.herokuapp.com fwd="173.199.115.131" dyno= connect= service= status=503 bytes=
  </code></pre>
  
  <p>and this: </p>
  
  <pre><code>    File "manage.py", line 10, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
      utility.execute()
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
      self.execute(*args, **options.__dict__)
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
      output = self.handle(*args, **options)
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
      return self.handle_noargs(**options)
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
      cursor = connection.cursor()
    File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/__init__.py", line 317, in cursor
      cursor = self.make_debug_cursor(self._cursor())
    File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 177, in _cursor
      self.connection = Database.connect(**conn_params)
    File "/app/.heroku/python/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
      conn = _connect(dsn, connection_factory=connection_factory, async=async)
  psycopg2.OperationalError: could not connect to server: Connection refused
      Is the server running on host "localhost" (127.0.0.1) and accepting
      TCP/IP connections on port 5432?
  </code></pre>
  
  <p>The things I can think of that I've tried:</p>
  
  <ul>
  <li>removed and replaced my Procfile (capitalized, yes) </li>
  <li>done pip freeze to my requirements.txt file</li>
  <li>added a runtime.txt file</li>
  <li>started a dyno</li>
  <li>followed all of the Heroku Django instructions</li>
  <li>re-arranged my directory structure (and moved my wsgi.py file to the same folder as
  requirements.txt)</li>
  <li>tried run_gunicorn (unknown command error)</li>
  <li>pip
  installed all of the dependencies (twice, including Django, psycopg2,
  dj-database-url)</li>
  <li>heroku run python manage.py syncdb (Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?)</li>
  <li>checked Postgres and Heroku toolbelt installations</li>
  </ul>
  
  <p>I would be very grateful to get some help.</p>