2

尝试在 heroku 上部署 django 应用程序时,出现以下错误。我可以在本地测试。它工作正常。但是“heroku run python manage.py syncdb”会导致以下错误。我浏览了其他一些相关的帖子,但找不到满意的答案。

我有 python 2.7 和 django 1.3 并使用 sqlite3 作为数据库。我正在尝试在 heroku 上部署以下内容 - https://github.com/Stackato-Apps/pinax-social。如果您需要更多信息,请告诉我。

Traceback (most recent call last):
  File "manage.py", line 31, in <module>
    execute_from_command_line()
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 257, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 7, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/sql.py", line 5, in <module>
    from django.contrib.contenttypes import generic
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/contrib/contenttypes/generic.py", line 6, in <module>
    from django.db import connection
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/__init__.py", line 75, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 91, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/utils.py", line 32, in load_backend
    return import_module('.base', backend_name)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 34, in <module>
    raise ImproperlyConfigured("Error loading %s: %s" % (module, exc))
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3
4

1 回答 1

1

Heroku 不支持 SQLite3,您应该使用 Postgres 配置您的应用程序,如此处所述https://devcenter.heroku.com/articles/django#database-settings

于 2012-08-02T10:19:33.073 回答