title: `TypeError: argument 2 must be a connection, cursor or None` in Psycopg2
body: <p>I have a heroku pipeline set up, and have just enabled review apps for it. It is using the same codebase as my staging and production apps, same settings files and everything.</p>
  
  <p>When the review app spins up, it can connect to the created DB and run migrations. When I try to connect to the app in the browser, I get </p>
  
  <pre><code>`TypeError: argument 2 must be a connection, cursor or None` in `psycopg2/_json.py, register_json:139`
  </code></pre>
  
  <p>Top of stack is: </p>
  
  <pre><code>`django.contrib.sites.models._get_site_by_id`.
  </code></pre>
  
  <p>I've attached the Opbeat output of the error frame at the bottom of this post.</p>
  
  <p><a href="https://github.com/phildini/logtacts/blob/master/logtacts/prod_settings/__init__.py" rel="noreferrer">Settings file</a> is linked.</p>
  
  <p>When I set <code>DEBUG=True</code>, everything works fine. Which might suggest an <code>ALLOWED_HOSTS</code> issue, but when I set <code>ALLOWED_HOSTS</code> to <code>'*'</code> with <code>DEBUG=False</code>, it still errors?</p>
  
  <p>What is wrong with my setup? This works in staging, and production, but not the review apps.</p>
  
  <p><a href="https://i.stack.imgur.com/HzaKg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HzaKg.png" alt="error frame"></a></p>