gpt4 book ai didi

python - 链接 mysql 和 django 时出错

转载 作者:太空宇宙 更新时间:2023-11-03 10:59:54 24 4
gpt4 key购买 nike

我正在使用 aptana 使用 django 创建网站。我已经安装了 mysql,但是当我运行这个命令时无法链接数据库 *Python2.7 manage.py runserver* 我收到一条消息说 Python2.7 无法识别,当我运行这个命令时 Python manage.py runserver我收到一条错误消息

C:\Users\George\Documents\Aptana Studio 3 Workspace\Firstwebsite>python manage.py runserver

验证模型...

Unhandled exception in thread started by <bound method Command.inner_run of <dja
ngo.contrib.staticfiles.management.commands.runserver.Command object at 0x028E5C
70>>
Traceback (most recent call last):

File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line
92, in inner_runself.validate(display_num_errors=True)

`File "C:\Python27\lib\site-packages\django\core\management\base.py", line 280, in
validate num_errors = get_validation_errors(s, app)`



File "C:\Python27\lib\site-packages\django\core\management\validation.py", line 28, in
get_validation_errors from django.db import models, connection



File "C:\Python27\lib\site-packages\django\db\__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])



File "C:\Python27\lib\site-packages\django\db\__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)



File "C:\Python27\lib\site-packages\django\db\utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])



File "C:\Python27\lib\site-packages\django\db\utils.py", line 27, in load_backend
return import_module('.base', backend_name)



File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in
import_module__import__(name)


File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 17, in
<module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" %
e)django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module
named MySQLdb

我正在使用 Django 1.5 和 python 2.7 以及 aptana 3我很困惑我是否将此命令绑定(bind)到正确的目录中。任何帮助!!!

最佳答案

您是否安装了 MySQLdb?这是一个系统库。在谷歌上快速搜索会显示几个网站,您可以从中下载此内容

其中一个是(链接来自 here),另一个是 post解决这个问题:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

http://sourceforge.net/projects/mysql-python/files/mysql-python/

关于python - 链接 mysql 和 django 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16715069/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com