Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Project Resources

Table of Contents

  1. Git Resources
  2. Web Design Resources
  3. Django Resources
  4. Heroku Resources
    1. Avoiding the macOS / psycopg2 error

Git Resources

Git Cheat Sheet

Web Design Resources

Django Resources

Heroku Resources

Avoiding the macOS / psycopg2 error

Use this code at the bottom of your settings.py file to try/catch the import of django-heroku so it only has to work when deployed to heroku and not locally:

# Activate Django-Heroku.
# Use this code to avoid the psycopg2 / django-heroku error!  
# Do NOT import django-heroku above!
try:
    if 'HEROKU' in os.environ:
        import django_heroku
        django_heroku.settings(locals())
except ImportError:
    found = False