# 基于下面库进行优化,主要适配Django==5.0.3以后的版本。修复原子事务报错的问题
安装:`pip install mysql_server_has_gone`
因为代码里用到了MySQLdb库,所以需要安装mysqlclient。如果你用到了其他库导致报错,可以github上滴滴我,我会及时修复的。
以下是原始文档:
# MySQL-server-has-gone-away
This repository solves issue where database connection inside of django overlives MySQL database connection timeout specified in `/etc/my.cnf` `wait_timeout = xxxx`. [See this issue](https://stackoverflow.com/questions/26958592/django-after-upgrade-mysql-server-has-gone-away)
## How to use:
1. For Django 1.x and 2.x use `pip install mysql_server_has_gone_away==1.0.0`
1. For django 3.x use `pip install mysql_server_has_gone==2.0.0`
1. Put this engine into Django `settings.py`:
```python
DATABASES = {
'default': {
'ENGINE': 'mysql_server_has_gone_away',
#'NAME': 'database-name',
#'USER': 'database-user',
#'PASSWORD': 'database-password',
#'HOST': 'localhost',
}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/maiyajj/MySQL-server-has-gone-away",
"name": "mysql-server-has-gone",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "maiyajj",
"author_email": "1045373828@qq.com",
"download_url": "https://files.pythonhosted.org/packages/cd/56/80b4ba1e6fd0fc3b43bdb84df7c99a130cfc7dcd52fe92d12b332ec77716/mysql_server_has_gone-2.0.5.tar.gz",
"platform": null,
"description": "# \u57fa\u4e8e\u4e0b\u9762\u5e93\u8fdb\u884c\u4f18\u5316\uff0c\u4e3b\u8981\u9002\u914dDjango==5.0.3\u4ee5\u540e\u7684\u7248\u672c\u3002\u4fee\u590d\u539f\u5b50\u4e8b\u52a1\u62a5\u9519\u7684\u95ee\u9898\r\n\r\n\u5b89\u88c5\uff1a`pip install mysql_server_has_gone`\r\n\u56e0\u4e3a\u4ee3\u7801\u91cc\u7528\u5230\u4e86MySQLdb\u5e93\uff0c\u6240\u4ee5\u9700\u8981\u5b89\u88c5mysqlclient\u3002\u5982\u679c\u4f60\u7528\u5230\u4e86\u5176\u4ed6\u5e93\u5bfc\u81f4\u62a5\u9519\uff0c\u53ef\u4ee5github\u4e0a\u6ef4\u6ef4\u6211\uff0c\u6211\u4f1a\u53ca\u65f6\u4fee\u590d\u7684\u3002\r\n\r\n\u4ee5\u4e0b\u662f\u539f\u59cb\u6587\u6863\uff1a\r\n\r\n# MySQL-server-has-gone-away\r\n\r\nThis repository solves issue where database connection inside of django overlives MySQL database connection timeout specified in `/etc/my.cnf` `wait_timeout = xxxx`. [See this issue](https://stackoverflow.com/questions/26958592/django-after-upgrade-mysql-server-has-gone-away)\r\n\r\n\r\n## How to use:\r\n1. For Django 1.x and 2.x use `pip install mysql_server_has_gone_away==1.0.0`\r\n\r\n1. For django 3.x use `pip install mysql_server_has_gone==2.0.0`\r\n\r\n1. Put this engine into Django `settings.py`:\r\n\r\n```python\r\nDATABASES = {\r\n\t'default': {\r\n\t\t'ENGINE': 'mysql_server_has_gone_away', \r\n\t\t#'NAME': 'database-name',\r\n\t\t#'USER': 'database-user',\r\n\t\t#'PASSWORD': 'database-password',\r\n\t\t#'HOST': 'localhost',\r\n\t}\r\n}\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django myslq backend that fixes issue with long living connection",
"version": "2.0.5",
"project_urls": {
"Homepage": "https://github.com/maiyajj/MySQL-server-has-gone-away"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5c286f29a5f04e434902a4fa14aade1f96e45a62dc7ea40f8bd1e4556118a0f3",
"md5": "3c64a2ff6bc6a91d056693e5154c610e",
"sha256": "12373228497b47c9283c8a78f295b481552a82247b0242fcd74d7dd673fe3b5d"
},
"downloads": -1,
"filename": "mysql_server_has_gone-2.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c64a2ff6bc6a91d056693e5154c610e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3976,
"upload_time": "2024-04-24T07:23:51",
"upload_time_iso_8601": "2024-04-24T07:23:51.283889Z",
"url": "https://files.pythonhosted.org/packages/5c/28/6f29a5f04e434902a4fa14aade1f96e45a62dc7ea40f8bd1e4556118a0f3/mysql_server_has_gone-2.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cd5680b4ba1e6fd0fc3b43bdb84df7c99a130cfc7dcd52fe92d12b332ec77716",
"md5": "bf047aa171077a13c78b4368c34c9ca3",
"sha256": "fa95410580b4cae4f11a198e7999092e66a02b3ec67ff912e6f4572e190c35a3"
},
"downloads": -1,
"filename": "mysql_server_has_gone-2.0.5.tar.gz",
"has_sig": false,
"md5_digest": "bf047aa171077a13c78b4368c34c9ca3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3395,
"upload_time": "2024-04-24T07:23:53",
"upload_time_iso_8601": "2024-04-24T07:23:53.295298Z",
"url": "https://files.pythonhosted.org/packages/cd/56/80b4ba1e6fd0fc3b43bdb84df7c99a130cfc7dcd52fe92d12b332ec77716/mysql_server_has_gone-2.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-24 07:23:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "maiyajj",
"github_project": "MySQL-server-has-gone-away",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mysql-server-has-gone"
}