编辑 - 更新和总结:
pinax-project-teams 代码与 Django 1.7 不完全兼容,至少在新 Django 项目的初始“原始”安装时不兼容。解决方法包括几个步骤:
- 从
startup.py (line 21, in run()) 中移除显式/冗余应用加载:注释掉或删除admin.autodiscover()。
- 显式安装 Django 1.6.5 (
pip install Django==1.6.5)。
- 通过 django 1.6 版本 (
python manage.py syncdb) 同步数据库。
- 显式安装 Django 1.7.5 (
pip install Django==1.7.5)。
原答案帖:
我想我已经把它缩小了一点,如果不在范围内,至少在根本原因上。虽然我的项目不是从 Django pinax-project-team 中的某些内容使其默认与 Django 1.7 不兼容。在 1.6.5 django 安装上,相同的安装将允许 syncdb 和 runserver,但 django-1.7.5 会抛出 Apps aren't loaded yet。
我找到了很长的Django 1.7 release notes 列表,我正在开始查看是否可以确定不兼容的原因。
至少其中一个问题是 Pinax 在 startup.py 中的“额外”自动发现,在 Django 自己的启动过程中 as of 1.7 release is automatically executed。这解决了应用程序加载问题,看起来......但django.contrib.sites 中还有另一个问题。在 1.7 中运行 migrate 时,由于数据库中缺少表,其中一个迁移失败,特别是 django_site(下面的完整跟踪)。此表确实存在于 1.6 django 安装的数据库中。修改 1.7 的设置指向 1.6 项目中的 sqlite 文件解决了这个问题,瞧,它工作了。所以这是我在 pinax-project-teams 和 Django 1.7 之间发现的仅有的两个冲突。
(env)trevor@nikola:mysite7$ python manage.py migrate
Operations to perform:
Synchronize unmigrated apps: wiki, account, eventlog, kaleo, profiles, easy_thumbnails, pinax_theme_bootstrap, teams, bootstrapform
Apply all migrations: admin, contenttypes, sites, auth, sessions
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 128, in handle
created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 298, in sync_apps
call_command('loaddata', 'initial_data', verbosity=self.verbosity, database=connection.alias, skip_validation=True, app_label=app_label, hide_empty=True)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 115, in call_command
return klass.execute(*args, **defaults)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 61, in handle
self.loaddata(fixture_labels)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 91, in loaddata
self.load_label(fixture_label)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 148, in load_label
obj.save(using=self.using)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/core/serializers/base.py", line 173, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/models/base.py", line 617, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/models/base.py", line 679, in _save_table
forced_update)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/models/base.py", line 723, in _do_update
return filtered._update(values) > 0
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/models/query.py", line 600, in _update
return query.get_compiler(self.db).execute_sql(CURSOR)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1004, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
cursor.execute(sql, params)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/Users/trevor/code/pinax/7-pinaxtest/env/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: Problem installing fixture '/Users/trevor/code/pinax/7-pinaxtest/mysite7/fixtures/initial_data.json': Could not load sites.Site(pk=1): no such table: django_site