Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django.db.utils.OperationalError: (2005, "Unknown server host 'host' (11001)")这个问题怎么解决 #603

Open
6 tasks
hdd-11 opened this issue Sep 7, 2022 · 1 comment

Comments

@hdd-11
Copy link

hdd-11 commented Sep 7, 2022

我确定我已经查看了 (标注[ ][x])


我要申请 (标注[ ][x])

  • BUG 反馈
  • 添加新的特性或者功能
  • 请求技术支持
@nongreen
Copy link

@hdd-11 您需要在文件 'djagoblog/settings.py' 中设置数据库设置。 如果您将使用 mysql,则需要创建新数据库并设置 djangoblog 设置以使用该数据库。 如果您将使用 sqlLite,您需要在数据库设置中指定它

在这里的 'djangoblog/settings.py' 中有设置。

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': os.environ.get('DJANGO_MYSQL_DATABASE') or 'djangoblog',
        'USER': os.environ.get('DJANGO_MYSQL_USER') or 'root',
        'PASSWORD': os.environ.get('DJANGO_MYSQL_PASSWORD') or 'djangoblog_123',
        'HOST': os.environ.get('DJANGO_MYSQL_HOST') or '127.0.0.1',
        'PORT': int(
            os.environ.get('DJANGO_MYSQL_PORT') or 3306),
        'OPTIONS': {
            'charset': 'utf8mb4'},
    }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant