【问题标题】:django mysql not run in macOS Big Surdjango mysql 无法在 macOS Big Sur 中运行
【发布时间】:2021-06-05 09:21:40
【问题描述】:

Big Sur 更新后的一些问题

我使用 Django 2.1.15 和 Python 3.8

根据帖子和文档,我安装了连接器

brew install mysql-connector-c  

pip install mysql-python     

安装mysql后

 brew install mysql     

和客户

 pip install mysqlclient     

尝试运行 django,我得到这个错误:

django.db.utils.OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 54")

这是我的设置.py

DATABASES = {
    'default': {

        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'BATABASE',
        'USER': 'sa',
        'PASSWORD': 'password',
        'HOST': '192.168.1.10',
        'PORT': '1433',
}
}

【问题讨论】:

    标签: mysql sql django macos


    【解决方案1】:

    你可以试试这个https://github.com/imagineai/create-django-app

    npm install -g 想象 && 想象创建 -f django -n myapp

    它将自动检测您的 Python 版本并安装适当的依赖项。你也可以在im文件中选择你想要的数据库。

    【讨论】:

      猜你喜欢
      • 2020-10-20
      • 2021-03-10
      • 1970-01-01
      • 1970-01-01
      • 2021-01-12
      • 2021-06-08
      • 2022-01-14
      • 2021-03-01
      • 2021-09-04
      相关资源
      最近更新 更多