【问题标题】:Installation of mysqlclient fails on shared hosting server using pip使用 pip 在共享主机服务器上安装 mysqlclient 失败
【发布时间】:2019-10-09 13:12:00
【问题描述】:

我想将 Django 应用程序连接到 mysql 数据库。推荐的解决方案是通过 pip 安装 mysqlclient。但是通过共享主机服务提供的接口安装失败。

我尝试通过 ssh 安装,但错误日志非常错误,并且存在权限错误。共享主机服务中无法访问 sudo 命令。

【问题讨论】:

标签: python mysql django pip


【解决方案1】:

Django 解决方案使用 PyMySQL 纯 python 实现。

1. pip install PyMySQL or PyMySQL = "*" in Pipfile
2. Editing __init__.py in base or config directory where settings.py exits

   import pymysql
   pymysql.version_info = (1, 4, 2, "final", 0)
   pymysql.install_as_MySQLdb()

如果您需要更具体的用例,请随时分享。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-15
    • 2011-08-01
    • 2016-01-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多