django 1.8 mysql_mysql - 升级1.7.4到django 1.8 south.db.mysql错误,不使用南 - 堆栈内存溢出...

尝试从django的1.7.4升级到1.8; 但是,当我运行服务器时,我现在得到了

There is no South database module 'south.db.mysql' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS.

错误消息,它不起作用。 我的INSTALLED_APPS中没有'South'。 并且不记得在这个项目上曾经使用过南方。 我的所有模型实际上是手动管理的。

我该如何解决?

谢谢

[编辑]你会看到,我有很多“升级”修复,但仍然不明白为什么它在'南'失败,我不使用它。

INSTALLED_APPS = (

'django_admin_bootstrapped',

'django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles',

'django.contrib.humanize',

'bootstrap3',

'towel',

'email_registration',

'visits',

'django_markdown',

'debug_toolbar',

'LessonApp',

'bootstrap_pagination',

'django_tables2',

'util',

'memcache_admin',

'twitter_feed',

'cec_cms',

'ckeditor',

'filebrowser',

'user_profile',

'eztexting',

'secure_file',

'partboard',

)

追溯:

/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py:171: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.

attrs["base_columns"] = SortedDict(parent_columns)

/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py:193: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.

attrs["base_columns"].update(SortedDict(cols))

/usr/local/lib/python2.7/dist-packages/south/modelsinspector.py:20: RemovedInDjango19Warning: django.contrib.contenttypes.generic is deprecated and will be removed in Django 1.9. Its contents have been moved to the fields, forms, and admin submodules of django.contrib.contenttypes.

from django.contrib.contenttypes import generic

/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py:174: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.

extra = SortedDict()

/home/marc/PycharmProjects/CECLessonApp/ckeditor/widgets.py:10: RemovedInDjango19Warning: The django.forms.util module has been renamed. Use django.forms.utils instead.

from django.forms.util import flatatt

/usr/local/lib/python2.7/dist-packages/memcache_admin/views.py:22: RemovedInDjango19Warning: 'get_cache' is deprecated in favor of 'caches'.

mc_client = get_cache(SETTINGS['CACHE'])._cache

/home/marc/PycharmProjects/CECLessonApp/CECLessonApp/urls.py:18: RemovedInDjango19Warning: Default value of 'RedirectView.permanent' will change from True to False in Django 1.9. Set an explicit value to silence this warning.

url(r'^favicon\.ico$', RedirectView.as_view(url='/static/favicon.ico')),

/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py:171: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.

attrs["base_columns"] = SortedDict(parent_columns)

/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py:193: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.

attrs["base_columns"].update(SortedDict(cols))

/usr/local/lib/python2.7/dist-packages/south/modelsinspector.py:20: RemovedInDjango19Warning: django.contrib.contenttypes.generic is deprecated and will be removed in Django 1.9. Its contents have been moved to the fields, forms, and admin submodules of django.contrib.contenttypes.

from django.contrib.contenttypes import generic

/usr/local/lib/python2.7/dist-packages/django_tables2/tables.py:174: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.

extra = SortedDict()

/home/marc/PycharmProjects/CECLessonApp/ckeditor/widgets.py:10: RemovedInDjango19Warning: The django.forms.util module has been renamed. Use django.forms.utils instead.

from django.forms.util import flatatt

/usr/local/lib/python2.7/dist-packages/memcache_admin/views.py:22: RemovedInDjango19Warning: 'get_cache' is deprecated in favor of 'caches'.

mc_client = get_cache(SETTINGS['CACHE'])._cache

/home/marc/PycharmProjects/CECLessonApp/CECLessonApp/urls.py:18: RemovedInDjango19Warning: Default value of 'RedirectView.permanent' will change from True to False in Django 1.9. Set an explicit value to silence this warning.

url(r'^favicon\.ico$', RedirectView.as_view(url='/static/favicon.ico')),

Performing system checks...

System check identified some issues:

WARNINGS:

visits.Visit.ip_address: (fields.W900) IPAddressField has been deprecated. Support for it (except in historical migrations) will be removed in Django 1.9.

HINT: Use GenericIPAddressField instead.

System check identified 1 issue (0 silenced).

/usr/local/lib/python2.7/dist-packages/south/db/generic.py:9: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead.

from django.db.backends.util import truncate_name

There is no South database module 'south.db.mysql' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Django 架构中,一般使用 Django 自带的 ORM(Object-Relational Mapping)来操作数据库。ORM 是一种将关系数据库中的数据映射到对象的技术,将程序中的对象转换为数据库中的记录,从而实现对数据库的操作。 不过,如果你想直接使用 MySQL Connector/Python 驱动来连接 MySQL 数据库,可以在 Django 项目中的 `__init__.py` 文件中进行相关配置。具体配置如下: 1. 安装 MySQL Connector/Python 驱动,可以使用 pip 命令进行安装: ``` pip install mysql-connector-python ``` 2. 在 Django 项目的 `__init__.py` 文件中添加以下代码: ```python import mysql.connector from django.db.backends.mysql.base import DatabaseWrapper # 定义 MySQL Connector/Python 驱动的数据库连接参数 cnx = mysql.connector.connect(user='your_username', password='your_password', host='your_host', database='your_database') # 重写 DjangoMySQL 数据库连接方法 class MySQLDatabaseWrapper(DatabaseWrapper): def get_new_connection(self, conn_params): return cnx # 注册 MySQLDatabaseWrapper DatabaseWrapper.register_backend('mysql.connector', 'django.db.backends.mysql.base', 'MySQLDatabaseWrapper') ``` 需要将上述代码中的 `your_username`、`your_password`、`your_host` 和 `your_database` 替换为实际的数据库连接参数。 3. 在 Django 项目的 `settings.py` 文件中,将 `DATABASES` 配置中的 `ENGINE` 改为 `django.db.backends.mysql.connector`,如下所示: ```python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql.connector', 'NAME': 'your_database', 'USER': 'your_username', 'PASSWORD': 'your_password', 'HOST': 'your_host', 'PORT': 'your_port', } } ``` 需要将上述代码中的 `your_username`、`your_password`、`your_host`、`your_database` 和 `your_port` 替换为实际的数据库连接参数。 这样,就可以在 Django 项目中使用 MySQL Connector/Python 驱动来连接 MySQL 数据库了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值