Ben bir django app heroku itmek ve heroku veya stackoverflow forumlarda herhangi bir yerde görmedim bir hata alıyorum çalışıyorum. Ben postgres kullanıyorum.django app Heroku itme "Psycopg2.extensions adında bir modül yok"
Nereye gideceğime emin değilim; Yanlış olanı yazan hiçbir dokümanda hiçbir şey göremiyorum.
ImportError: Ana hatadır hiçbir modül adlı psycopg2.extensions
... ama Heroku yapılandırma MOTORU olarak, ben onun tarafından nasıl bilmiyorum kuruyor biridir .
Heroku ile sohbetim emin olmak için, Postgres'e
bilen$ heroku addons:add heroku-postgresql:dev
Adding heroku-postgresql:dev on morning-crag-1585... done, v24 (free)
Attached as HEROKU_POSTGRESQL_OLIVE_URL
Database has been created and is available
! This database is empty. If upgrading, you can transfer
! data from another database with pgbackups:restore.
.
Use `heroku addons:docs heroku-postgresql:dev` to view documentation.
$ heroku pg:wait
$ heroku config | grep HEROKU_POSTGRESQL
HEROKU_POSTGRESQL_OLIVE_URL: postgres://<blah-blah-blah>@ec2-<ip-address>.compute-1.amazonaws.com:5432/<blah-blah>
$ heroku pg:promote HEROKU_POSTGRESQL_OLIVE_URL
Promoting HEROKU_POSTGRESQL_OLIVE_URL to DATABASE_URL... done
Benim requirements.txt:
Django==1.4.2
wsgiref==0.1.2
dj-database-url==0.2.1
benim settings.py A pasajı:
print "Got here before!\n"
try:
import dj_database_url
DATABASES = { 'default': dj_database_url.config(default='postgres://localhost') }
except:
print "Unexpected error:", sys.exc_info()
print DATABASES
Ben heroku için itin, bunu heroku logs
'dan aldım:
heroku[slugc]: Slug compilation finished
heroku[web.1]: Starting process with command `python ./manage.py runserver 0.0.0.0:30550 --noreload`
app[web.1]: Got here before!
app[web.1]:
app[web.1]: {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': '<blah blah>', 'HOST': 'ec2-<iip-address>.compute-1.amazonaws.com', 'USER': '<blah blah>', 'PASSWORD': '<blah>', 'PORT': 5432}}
app[web.1]:
app[web.1]: Validating models...
app[web.1]: Traceback (most recent call last):
app[web.1]: File "./manage.py", line 10, in <module>
app[web.1]: execute_from_command_line(sys.argv)
app[web.1]: utility.execute()
app[web.1]: self.execute(*args, **options.__dict__)
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
app[web.1]: self.fetch_command(subcommand).run_from_argv(self.argv)
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
app[web.1]: self.inner_run(*args, **options)
app[web.1]: self.validate(display_num_errors=True)
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run
app[web.1]: num_errors = get_validation_errors(s, app)
app[web.1]: self.run(*args, **options)
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 92, in __getitem__
app[web.1]: output = self.handle(*args, **options)
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/validation.py", line 23, in get_validation_errors
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
app[web.1]: from django.db import models, connection
app[web.1]: return import_module('.base', backend_name)
app[web.1]: __import__(name)
app[web.1]: ImportError: No module named psycopg2.extensions
app[web.1]: return getattr(connections[DEFAULT_DB_ALIAS], item)
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/creation.py", line 1, in <module>
app[web.1]: backend = load_backend(db['ENGINE'])
app[web.1]: import psycopg2.extensions
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 40, in <module>
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 69, in handle
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 80, in run
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 24, in load_backend
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/base.py", line 266, in validate
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
app[web.1]: backend = load_backend(connection.settings_dict['ENGINE'])
app[web.1]: from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
app[web.1]: File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 13, in <module>
heroku[web.1]: Process exited with status 1
heroku[web.1]: State changed from starting to crashed
+1. https://devcenter.heroku.com/articles/django#prerequisites – danihp
D'oh! Teşekkürler! Bunu yaptı ve dokümanlar daha yakından okudu (onları tekrar tekrar okuyordum ama bir şekilde o çizgiyi kaçırıyordum) –