可以在Django(dev 1.6.x)和Python3.x中使用MySQL吗? [英] Can I use MySQL on Django(dev 1.6.x) with Python3.x?

查看:130
本文介绍了可以在Django(dev 1.6.x)和Python3.x中使用MySQL吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git repo中的Django dev(1.6.x),我想使用MySQL,但是在 settings.py 文件无法设置MySQL,因为MySQL不是支持python3和Django,所以我在python3.x上使用pymysql包没有任何问题,但在Django中也无法在 settings.py 上设置。



我可以使用python3在django上使用mysql(或pymysql还是?)?

解决方案

pymysql对于python 3不是Django DB后端,但是有证据表明,在 Django Python 3 MySQL后端更改



其他页面显示,使用Django 1.5给出的MySQL后端与Python 3配合使用:
Django MySQL Works on Python 3.2.2



Python 2.x(mysql-python)上提供的默认MySQL包装器不支持Python 3.
我怀疑在 MySQL Python 3 兼容,您可以尝试一下。



还要确保您使用Python 3.2或3.3或更高版本运行Django。不支持Python 3.0。



如果这些检查仍然不起作用,请发布您的DATABASES设置,以防万一出现问题。



另外,Django repos中没有找到任何Django 1.5以上的内容,你确定它是1.6.x吗?


I use Django dev(1.6.x) from git repo and I want to use MySQL , But on the settings.py file can not setup MySQL because MySQL is not supported in python3 and Django, So I used pymysql package on python3.x without any problem but in Django can not setup that on settings.py too.

Can I use mysql(or pymysql or ?) on django with python3 ?

解决方案

pymysql for python 3 is not a Django DB backend, however there is evidence that some work has been made porting the MySQL Backend to be Python 3 compatible at Django Python 3 MySQL backend changes.

Other pages show that the MySQL backend given with Django 1.5 works with Python 3 : Django MySQL Works on Python 3.2.2

The default MySQL wrapper available on Python 2.x (mysql-python) does however not support Python 3. I suspect the package at MySQL Python 3 to be compatible, you might give it a try.

Also make sure you're running Django with Python 3.2 or 3.3 or above. Python 3.0 is not supported.

If it still does not work after these checks, please post your DATABASES settings in case something was wrong in it.

Also, I don't find anything above Django 1.5 in the Django repos, are you sure it's 1.6.x ?

这篇关于可以在Django(dev 1.6.x)和Python3.x中使用MySQL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆