我有一个问题,当我使用带有wsgi的apache运行django项目系统时,mysqldb无法加载,系统报告如下错误:
...
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/util.py", line 1, in <module>
[Fri Apr 01 11:00:11 2011] [error] [client ::1] from django.db import models
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/__init__.py", line 78, in <module>
[Fri Apr 01 11:00:11 2011] [error] [client ::1] connection = connections[DEFAULT_DB_ALIAS]
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 93, in __getitem__
[Fri Apr 01 11:00:11 2011] [error] [client ::1] backend = load_backend(db['ENGINE'])
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 33, in load_backend
[Fri Apr 01 11:00:11 2011] [error] [client ::1] return import_module('.base', backend_name)
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
[Fri Apr 01 11:00:11 2011] [error] [client ::1] __import__(name)
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/gis/db/backends/mysql/base.py", line 1, in <module>
[Fri Apr 01 11:00:11 2011] [error] [client ::1] from django.db.backends.mysql.base import *
[Fri Apr 01 11:00:11 2011] [error] [client ::1] File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
[Fri Apr 01 11:00:11 2011] [error] [client ::1] raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Fri Apr 01 11:00:11 2011] [error] [client ::1] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: Error loading MySQLdb module: dlopen(/Users/LechterLin/.python-eggs/MySQL_python-1.2.3-p
y2.7-macosx-10.6-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
[Fri Apr 01 11:00:11 2011] [error] [client ::1] Referenced from: /Users/LechterLin/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg-tmp/_mysql.so
[Fri Apr 01 11:00:11 2011] [error] [client ::1] Reason: image not found
django项目中的wsgi文件和apache中的httpd.conf是正确的,因为我在WindowsXP中使用相同的文件(或命令),项目可以成功运行。
此报告类似于错误我只安装python和没有MySQL-python适配器的MySQL。那么这两个错误有什么关系吗?
我通过谷歌搜索了这个错误,似乎这个问题只能在MACOSX10.6中找到。 我的系统问题如下: Os:MACOSX10.6.7雪豹 MySQL:5.5.10 python:2.7 MySQL-python适配器:1.2.3 Apache:2.2.17 mod_wsgi:3.3 django:1.3
希望得到你的帮助!非常感谢!
答案 0 :(得分:1)
阅读:
https://groups.google.com/d/topic/modwsgi/aNSeRUiF1OY/discussion
在那里进行检查,根据您安装的东西进行必要的调整。
然后跟进关于mod_wsgi邮件列表的讨论,得到你得到的结果,这样可以进一步调试。 StackOverflow不是一个尝试和调试问题的好地方,只有在有人知道确切答案时才有用。不幸的是,有问题的最后一个人不会为回答这些问题或表明他们如何解决问题而烦恼,所以暂时还没有明确的简短回答。