解决Django连接db遇到的问题

yipeiwu_com7年前Python基础

1、django.db.utils.ConnectionDoesNotExist: The connection default doesn't exist

解决:第一个连接的命名一定要是default,将EN5Test改为default即可

2、django.core.exceptions.ImproperlyConfigured

Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings  
在执行检查连接是否成功的语句前,执行set DJANGO_SETTINGS_MODULE=mysite.settings即可

3、django.db.utils.OperationalError: (1045, “Access denied for user ‘账号'@'localhost' (using password: YES)”)

基本上是账号、密码错误,连接的HOST和账号不符,修改即可

以上这篇解决Django连接db遇到的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Python中的日期时间处理详解

Python中的日期时间处理详解

Python中关于时间、日期的处理库有三个:time、datetime和Calendar,其中datetime又有datetime.date、datetime.time、datetime...

python3 json数据格式的转换(dumps/loads的使用、dict to str/str to dict、json字符串/字典的相互转换)

python3 json数据格式的转换(dumps/loads的使用、dict to str/str to dict、json字符串/字典的相互转换)

python3 json数据格式的转换(dumps/loads的使用、dict to str/str to dict、json字符串/字典的相互转换) Python3 JSON 数据解析...

用Python的Django框架编写从Google Adsense中获得报表的应用

 我完成了更新我们在 Neutron的实时收入统计。在我花了一周的时间完成并且更新了我们的PHP脚本之后,我最终认决定开始使用Python进行抓取,这是值得我去花费我的时间和精...

Python中使用glob和rmtree删除目录子目录及所有文件的例子

一、batch与shell中 目录及文件: 复制代码 代码如下: C:\TESTFOLDER\TEST ├─Test2 └─Test3     &...

Python的string模块中的Template类字符串模板用法

string.Template() string.Template()内添加替换的字符, 使用"$"符号, 或 在字符串内, 使用"${}"; 调用时使用string.substitut...