justinvh / gitpaste

DEPRECATED - GitPaste is a clone of GitHub's Gist.
Other
184 stars 49 forks source link

No module named psycopg2 #36

Open cyrusdavid opened 10 years ago

cyrusdavid commented 10 years ago

Hi, i'm trying gitpaste on heroku and I'm getting the following error:

2013-11-19T10:19:04.189815+00:00 heroku[web.1]: Starting process with command `cd saic && sh runserver.sh`
2013-11-19T10:19:04.421528+00:00 heroku[web.1]: Process exited with status 1
2013-11-19T10:19:05.518991+00:00 app[web.1]: Traceback (most recent call last):
2013-11-19T10:19:05.518991+00:00 app[web.1]:   File "manage.py", line 18, in <module>
2013-11-19T10:19:05.518991+00:00 app[web.1]:     execute_manager(settings)
2013-11-19T10:19:05.518991+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
2013-11-19T10:19:05.518991+00:00 app[web.1]:     utility.execute()
2013-11-19T10:19:05.518991+00:00 app[web.1]:     self.fetch_command(subcommand).run_from_argv(self.argv)
2013-11-19T10:19:05.518991+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
2013-11-19T10:19:05.518991+00:00 app[web.1]:     self.execute(*args, **options.__dict__)
2013-11-19T10:19:05.519334+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 100, in activate
2013-11-19T10:19:05.519334+00:00 app[web.1]:     return _trans.activate(language)
2013-11-19T10:19:05.518991+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
2013-11-19T10:19:05.519334+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 202, in activate
2013-11-19T10:19:05.519334+00:00 app[web.1]:     default_translation = _fetch(settings.LANGUAGE_CODE)
2013-11-19T10:19:05.519334+00:00 app[web.1]:     _active.value = translation(language)
2013-11-19T10:19:05.519334+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 185, in translation
2013-11-19T10:19:05.519334+00:00 app[web.1]:     app = import_module(appname)
2013-11-19T10:19:05.519334+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2013-11-19T10:19:05.519635+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/haystack/__init__.py", line 57, in load_backend
2013-11-19T10:19:05.519635+00:00 app[web.1]:     backend = load_backend(settings.HAYSTACK_SEARCH_ENGINE)
2013-11-19T10:19:05.519635+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2013-11-19T10:19:05.519635+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/haystack/backends/__init__.py", line 6, in <module>
2013-11-19T10:19:05.519635+00:00 app[web.1]:     from django.db.models import Q
2013-11-19T10:19:05.520307+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 93, in __getitem__
2013-11-19T10:19:05.519635+00:00 app[web.1]:     __import__(name)
2013-11-19T10:19:05.520307+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2013-11-19T10:19:05.520307+00:00 app[web.1]:     return import_module('.base', backend_name)
2013-11-19T10:19:05.519635+00:00 app[web.1]:     return importlib.import_module('haystack.backends.%s_backend' % backend_name)
2013-11-19T10:19:05.519635+00:00 app[web.1]:     __import__(name)
2013-11-19T10:19:05.519334+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
2013-11-19T10:19:05.518991+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 209, in execute
2013-11-19T10:19:05.519635+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/db/__init__.py", line 78, in <module>
2013-11-19T10:19:05.520307+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named psycopg2
2013-11-19T10:19:05.520307+00:00 app[web.1]:     connection = connections[DEFAULT_DB_ALIAS]
2013-11-19T10:19:05.519635+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/haystack/__init__.py", line 83, in <module>
2013-11-19T10:19:05.520307+00:00 app[web.1]:     raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
2013-11-19T10:19:05.520307+00:00 app[web.1]:     backend = load_backend(db['ENGINE'])
2013-11-19T10:19:05.519334+00:00 app[web.1]:     translation.activate('en-us')
2013-11-19T10:19:05.520307+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 33, in load_backend
2013-11-19T10:19:05.520307+00:00 app[web.1]:     __import__(name)
2013-11-19T10:19:05.520307+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 24, in <module>
2013-11-19T10:19:06.863840+00:00 heroku[web.1]: Process exited with status 1
2013-11-19T10:19:06.876045+00:00 heroku[web.1]: State changed from starting to crashed
Karunamon commented 10 years ago

Not mentioned in the requirements is that this app is set up, out of the box, for a Postgres database backend. I had great success editing the configuration file to specify SQLite - you may or may not want to do this depending on how much use this app is going to get.

On line 41 of saic/settings.py, change the line to read 'ENGINE': 'django.db.backends.sqlite3'

If you really want to use Postgres anyways, just do a pip install psycopg2 and configure your database appropriately.