已有184人关注
求解
还有0人有此问题
发表在Python图书答疑 2019-12-18 《零基础学Python》
是否精华
版块置顶:

D:\python程序\examination>venv\Scripts\activate

(venv) D:\python程序\examination>python manage.py migrate
Traceback (most recent call last):
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\logging\config.py", line 563, in configure
    handler = self.configure_handler(handlers[name])
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\logging\config.py", line 736, in configure_handler
    result = factory(**kwargs)
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\logging\__init__.py", line 1087, in __init__
    StreamHandler.__init__(self, self._open())
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\logging\__init__.py", line 1116, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\tmp\\test.log'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\__init__.py", line 337, in execute
    django.setup()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\__init__.py", line 22, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\utils\log.py", line 75, in configure_logging
    logging_config_func(logging_settings)
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\logging\config.py", line 800, in dictConfig
    dictConfigClass(config).configure()
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\logging\config.py", line 571, in configure
    '%r' % name) from e
ValueError: Unable to configure handler 'file'

(venv) D:\python程序\examination>

分享到:
精彩评论 3
andy
学分:2118 LV10
TA的每日心情
继续努力
2017-02-06 23:42:34
2019-12-19
沙发

FileNotFoundError: [Errno 2] No such file or directory: 'D:\\tmp\\test.log'

在电脑的D盘下创建一个tmp文件夹,在文件夹下创建一个test.log文件

smerra_
学分:419 LV5
2019-12-19
板凳

现在又成这样了

(venv) D:\python程序\examination>python manage.py migrate
Traceback (most recent call last):
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\connections.py", line 920, in connect
    **kwargs)
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\socket.py", line 727, in create_connection
    raise err
  File "C:\Users\ianke\AppData\Local\Programs\Python\Python37\lib\socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 213, in ensu
re_connection
    self.connect()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 189, in conn
ect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\mysql\base.py", line 274, in get
_new_connection
    conn = Database.connect(**conn_params)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\connections.py", line 699, in __init__
    self.connect()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\connections.py", line 967, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([WinError 10061] 由于目标计算机积极
拒绝,无法连接。)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\__init__.py", line 363, in e
xecute_from_command_line
    utility.execute()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\__init__.py", line 355, in e
xecute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\base.py", line 283, in run_f
rom_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\base.py", line 327, in execu
te
    self.check()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\base.py", line 359, in check

    include_deployment_checks=include_deployment_checks,
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\management\commands\migrate.py", line 6
1, in _run_checks
    issues = run_checks(tags=[Tags.database])
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\checks\registry.py", line 81, in run_ch
ecks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\core\checks\database.py", line 10, in check_
database_backends
    issues.extend(conn.validation.check(**kwargs))
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\mysql\validation.py", line 9, in
 check
    issues.extend(self._check_sql_mode(**kwargs))
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\mysql\validation.py", line 13, i
n _check_sql_mode
    with self.connection.cursor() as cursor:
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 254, in curs
or
    return self._cursor()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 229, in _cur
sor
    self.ensure_connection()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 213, in ensu
re_connection
    self.connect()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\utils\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 213, in ensu
re_connection
    self.connect()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\base\base.py", line 189, in conn
ect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\django\db\backends\mysql\base.py", line 274, in get
_new_connection
    conn = Database.connect(**conn_params)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\__init__.py", line 90, in Connect
    return Connection(*args, **kwargs)
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\connections.py", line 699, in __init__
    self.connect()
  File "C:\Users\ianke\AppData\Roaming\Python\Python37\site-packages\pymysql\connections.py", line 967, in connect
    raise exc
django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([WinError 10061] 由于目标计算机
积极拒绝,无法连接。)")

(venv) D:\python程序\examination>

andy
学分:2118 LV10
TA的每日心情
继续努力
2017-02-06 23:42:34
2019-12-20
地板

django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([WinError 10061] 由于目标计算机
积极拒绝,无法连接。)")

这个错误很明显,没有连接MySQL。


首页上一页 1 下一页尾页 3 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照