django linux 有时候获取时间不对,关于Django版本不对遇到的一个问题

工作环境Ubuntu,因为买了个固态硬盘,重装了一个系统,之前系统的Django工程移动过来之后,执行python manage syncdb的时候爆出如下错误:

Operations to perform:

Synchronize unmigrated apps: user_notice, user_like, user_profile, front_page, tinymce, user_collect, user_friend, user_blog, user_group, friend_group

Apply all migrations: admin, contenttypes, auth, sessions

Synchronizing apps without migrations:

Creating tables...

Installing custom SQL...

Installing indexes...

Running migrations:

Applying contenttypes.0001_initial...Traceback (most recent call last):

File "manage.py", line 10, in

execute_from_command_line(sys.argv)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/__init__.py", line 385, in execute_from_command_line

utility.execute()

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/__init__.py", line 377, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/base.py", line 288, in run_from_argv

self.execute(*args, **options.__dict__)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/base.py", line 338, in execute

output = self.handle(*args, **options)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/base.py", line 533, in handle

return self.handle_noargs(**options)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/commands/syncdb.py", line 27, in handle_noargs

call_command("migrate", **options)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/__init__.py", line 115, in call_command

return klass.execute(*args, **defaults)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/base.py", line 338, in execute

output = self.handle(*args, **options)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/core/management/commands/migrate.py", line 160, in handle

executor.migrate(targets, plan, fake=options.get("fake", False))

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/db/migrations/executor.py", line 63, in migrate

self.apply_migration(migration, fake=fake)

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/db/migrations/executor.py", line 91, in apply_migration

if self.detect_soft_applied(migration):

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/db/migrations/executor.py", line 135, in detect_soft_applied

apps = project_state.render()

File "/usr/local/lib/python2.7/dist-packages/Django-1.7-py2.7.egg/django/db/migrations/state.py", line 71, in render

raise InvalidBasesError("Cannot resolve bases for %r\nThis can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)\n in an app with no migrations; see https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies for more" % new_unrendered_models)

django.db.migrations.state.InvalidBasesError: Cannot resolve bases for []

This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)

in an app with no migrations; see https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies for more

1.后来自己上网查找原因,未果。因为我装的Django的1.7版本的,后来索性看一下是不是Django版本的原因,就装回Django1.6版本,阴差样错的成功了。不知其所以然。写下来希望对大家会有帮助。

2.后来又发现要版本升级后要进行数据迁移,执行 python manage.py migrate 命令就好了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值