什么是PyMySQL,它与MySQLdb有什么区别?它可以影响Django部署吗? [英] What is PyMySQL and how does it differ from MySQLdb? Can it affect Django deployment?

查看:526
本文介绍了什么是PyMySQL,它与MySQLdb有什么区别?它可以影响Django部署吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚通过使用PyMySQL而不是MySQLdb解决了Django 1.3应用程序中的一些问题。我遵循本教程介绍如何进行切换: http://web-eng-help.blogspot.com/2010/09/install-mysql-5-for-python-26-and.html

I just solved some problems in my Django 1.3 app by using PyMySQL instead of MySQLdb. I followed this tutorial on how to make the switch: http://web-eng-help.blogspot.com/2010/09/install-mysql-5-for-python-26-and.html

现在我想知道PyMySQL实际上是什么,以及它与MySQLdb的不同。

Now I want to know what PyMySQL actually is and how it is different from MySQLdb.

我在localhost上使用它,然后将其上传到一些主机。

I am using it on localhost and will then upload it to some hosting.

在本地主机上使用PyMySQL并托管其提供的任何东西都可以吗?由于我已经将base.py和introspection.py中的MySQLdb更改为PyMySQL,因此在更改这些文件后,需要将其上传到服务器?或者是Django的文件,因为Django将会被上传到这里,这不重要吗?

Is it fine to use PyMySQL on localhost and on hosting whatever they provide? Since I have changed "MySQLdb" in base.py and introspection.py to "PyMySQL", will I need to upload it to the server after changing these files? Or as it is Django's files, since Django will be uploaded there already, does it not matter much?

推荐答案

PyMySQL和MySQLdb是两个用于Python的数据库连接器,用于使Python程序与MySQL服务器通信的库。

PyMySQL and MySQLdb are both database connectors for Python, libraries to enable Python programs to talk to a MySQL server.

部署应用程序时通常不会上传核心Django文件。如果Django在您的部署服务器上正常工作,您绝对不需要改变任何内容。 DB驱动程序在ORM之下是一两步,当然你没有写任何代码取决于哪些代码正在使用。

You would normally never upload core Django files when deploying an app. If Django is working fine on your deployment server, you definitely don't need to change anything there. The DB driver is a step or two below the ORM even, and certainly none of the code you have written depends on which of these is in use.

这篇关于什么是PyMySQL,它与MySQLdb有什么区别?它可以影响Django部署吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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