geodjango 与 mysql 不迁移 [英] geodjango with mysql not migrating
本文介绍了geodjango 与 mysql 不迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究 geodjango,但在这里遇到了一个问题带有 mysql 数据库的 geodjango解决.当我运行迁移时出现以下错误
I am working on geodjango and just got an issue here geodjango with mysql database resolved. When I ran migrate I got the following error
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
self.check()
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks
issues.extend(super(Command, self)._run_checks(**kwargs))
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 30, in check_all_models
errors.extend(model.check(**kwargs))
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/db/models/base.py", line 1283, in check
errors.extend(cls._check_fields(**kwargs))
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/db/models/base.py", line 1358, in _check_fields
errors.extend(field.check(**kwargs))
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 219, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 322, in _check_backend_specific_checks
return connections[db].validation.check_field(self, **kwargs)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/db/backends/mysql/validation.py", line 49, in check_field
field_type = field.db_type(self.connection)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 126, in db_type
return connection.ops.geo_db_type(self)
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
这是我的数据库设置
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'arbithub',
'USER': 'root',
'PASSWORD': 'root',
'HOST': 'localhost',
'PORT': '3306',
}
}
将根据要求提供更多代码
further codes would be supplied on request
推荐答案
您需要启用 空间后端 在您的 DATABASES
设置中.
You need to enable the spatial backend in your DATABASES
setting.
对于MySQL,替换
'ENGINE': 'django.db.backends.mysql',
与
'ENGINE': 'django.contrib.gis.db.backends.mysql',
这篇关于geodjango 与 mysql 不迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文