使用 mod_wsgi 在 Apache 上运行 Django 时出现 Python 链接问题:未找到符号 __cg_jpeg_resync_to_restart
当我尝试在 apache 上运行 django 站点时,出现此错误。该网站在开发服务器上运行:
ViewDoesNotExist at /
Could not import myproject.modulename.views. Error was: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_tkinter.so, 2): Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /Applications/MAMP/Library/lib/libjpeg.8.dylib
我不确定如何解决该问题。其他 django 站点也可以在此 apache 安装上运行。该目录位于我的 apache.conf 文件中指定的路径(请参阅帖子底部)。
错误消息中引用的三个文件存在于指示的位置。
_tkinter.so -
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_tkinter.so
ImageIO -
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
libjpeg.8.dylib -
/Applications/MAMP/Library/lib/libjpeg.8.dylib
我不确定 __cg_jpeg_resync_to_restart 是什么。
以下是我在尝试弄清楚错误消息的含义时发布的原始消息。感谢 sacabuche 为我指明了正确的方向。
我正在尝试让 Django 站点在 apache 上运行。它可以在 django 开发服务器上运行,但是当我尝试使用 mod_wsgi 在 apache 上运行它时,出现此错误。我知道 mod_wsgi 可以工作,因为我有一个小型试用站点(这是该 stie 的缩小版)在我的 mamp 开发服务器上运行。我通过这篇文章在其他人的帮助下完成了一项壮举: Django/mod_wsgi 和 PHP 作为使用 MAMP 的同一 Apache 服务器上的虚拟主机
新站点使用不同的数据库,现在位于 localhost 根目录,但其他方面非常好类似,所以这个错误让我感到困惑。
这是我的 apache conf 的代码(注意:php 站点可以工作,如果我将 WSGIDaemonProcess 重定向到旧站点,它加载时不会出现问题):
服务器名称 localhost 使用规范名称关闭 DocumentRoot“/Applications/MAMP/htdocs”
Alias /phpsite /Applications/MAMP/htdocs/phpsite
<Directory "/Applications/MAMP/htdocs/phpsite">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess site1 display-name=%{GROUP}
WSGIProcessGroup site1
Alias /media/ /Applications/MAMP/htdocs/media/
<Directory /Applications/MAMP/htdocs/media>
Options ExecCGI
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /Users/sequoia/djangoprojects/myproject/apache/django.wsgi
<Directory /Users/sequoia/djangoprojects/myproject/apache>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
谢谢。
I get this error when I try to run my django site on apache. The site works on the development server:
ViewDoesNotExist at /
Could not import myproject.modulename.views. Error was: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_tkinter.so, 2): Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /Applications/MAMP/Library/lib/libjpeg.8.dylib
I am not sure how to resolve the issue. Other django sites work on this apache installation. The directory is on the path specified in my apache.conf file (see bottom of the post).
The three files referenced in the error message exist in the locations indicated.
_tkinter.so -
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_tkinter.so
ImageIO -
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
libjpeg.8.dylib -
/Applications/MAMP/Library/lib/libjpeg.8.dylib
I am not sure what __cg_jpeg_resync_to_restart
is.
Below is the original message I put up when I was trying to figure out what the error message meant. Thanks to sacabuche for pointing me in the right direction.
I am trying to get a Django Site to run on apache. It works on the django development server, but I get this error when I try to run it on apache with mod_wsgi. I know mod_wsgi works because I had a small trial site (that was a scaled down version of this stie) working on my mamp development server. A feat I managed with the help of others via this post: Django/mod_wsgi and PHP as Virtual Hosts on same Apache Server using MAMP
The new site uses a different database and is now at the localhost root, but otherwise is very similar, so this error is baffling me.
Here is the code for my apache conf (note: the php site works, and if I redirect the WSGIDaemonProcess to the old site, it loads without problem):
ServerName localhost
UseCanonicalName Off
DocumentRoot "/Applications/MAMP/htdocs"
Alias /phpsite /Applications/MAMP/htdocs/phpsite
<Directory "/Applications/MAMP/htdocs/phpsite">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess site1 display-name=%{GROUP}
WSGIProcessGroup site1
Alias /media/ /Applications/MAMP/htdocs/media/
<Directory /Applications/MAMP/htdocs/media>
Options ExecCGI
Order deny,allow
Allow from all
</Directory>
WSGIScriptAlias / /Users/sequoia/djangoprojects/myproject/apache/django.wsgi
<Directory /Users/sequoia/djangoprojects/myproject/apache>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,似乎符号链接已损坏,所以我查看了一下,在 本论坛
删除
“<安装目录>/lib”中的符号链接“libpng.dylib”和“libjpeg.dylib”
创建新的到正确库的符号链接。
我这里没有 Mac 设备,但首先我会验证符号链接的来源是否存在,我希望这能解决您的问题。
Well it seems that a symlink is broken, so i looked and i found something in this forum
delete the symlinks "libpng.dylib" and "libjpeg.dylib" in
"<installation directory>/lib"
Create new symlinks to the right libs.
I have no Mac rigth here, but first i would verify that the origin of the symlink exist, i hope this will solve your problem.
您是否错过了选项声明中的+或-号?
声明示例:
选项-索引+FollowSymLinks
Don't you miss the + or - sign in your options statement?
Example of statement:
Options -Indexes +FollowSymLinks