Django,PostgreSQL和SQLAlchemy

时间:2015-02-18 18:28:30

标签: django postgresql sqlalchemy

在这些软件包上启动干净项目后(基本上是我的requirements.txt):

Django>=1.7, <1.8
psycopg2
aldjemy

我的python manage.py migrate提出错误:

  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/models.py", line 2, in <module>
    from .orm import prepare_models
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/orm.py", line 7, in <module>
    from .core import get_tables, get_engine, Cache
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/core.py", line 6, in <module>
    from .table import generate_tables
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/table.py", line 4, in <module>
    from django.db.models.loading import AppCache
ImportError: cannot import name 'AppCache'
(env)3-AM-OSX:bank stay-wide-awake$ python manage.py makemigrations accounts
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/models.py", line 2, in <module>
    from .orm import prepare_models
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/orm.py", line 7, in <module>
    from .core import get_tables, get_engine, Cache
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/core.py", line 6, in <module>
    from .table import generate_tables
  File "/Users/stay-wide-awake/web/bank/env/lib/python3.4/site-packages/aldjemy/table.py", line 4, in <module>
    from django.db.models.loading import AppCache
ImportError: cannot import name 'AppCache'

我在配置中使用的数据库无关紧要 - postgresql或sqlite,所以我发现SQLAlchemy正在导致扩展。但我无法弄清问题在哪里。你能帮忙吗?

我也使用Python3.4,你可以从日志中看到。

1 个答案:

答案 0 :(得分:0)

直接从repository安装有帮助!