500内部服务器错误导入WSGI中一个Python模块时, [英] 500 internal server error when importing a python module in wsgi

查看:263
本文介绍了500内部服务器错误导入WSGI中一个Python模块时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了通过使用PEST WSGI库异步执行功能的Python脚本。然而,当我试图导入另一个模块它只是导致500错误。

I've got a Python script that is executing functions asynchronously by using PEST wsgi library. However, when I try to import another module it simply results in a 500 error.

我尝试引用它的方法是:

The way I try to reference it is:

from foo import * 
from foo import Foo

其中foo是一个文件的.py中,我有我要引用的对象。

where foo is a file .py in which I have the object that I want to reference to.

试图监测通过Chrome的检查元素控制的电话,但一直没找到的东西。

Tried to monitor the calls through Chrome's Inspect Element Control but couldn't find a thing.

也试过使用Apache的错误日志来调试,但什么也没有。结果
任何提示AP preciated。

Also tried to debug using Apache's error log, but nothing there.
Any hints appreciated.

更新:
我已经试过这导致在相同的500错误如下:

Update: I've tried the following which resulted in the same 500 error:

- 使用

import site 

site.addsitedir("path/to/my/py/files/folder")

- 插入修改的Apache2 httpd.conf文件如下:

--modify the Apache2 httpd.conf file by inserting the following:

WSGIPythonPath /path/to/my/py/files/folder

- 修改/etc/apache2/sites-available/myapp.conf应用的conf文件,通过将上述WSGIPythonPath

--modify the application conf file in /etc/apache2/sites-available/myapp.conf, by inserting the above WSGIPythonPath

推荐答案

添加

WSGIPythonPath /path/to/my/py/files/folder

在应用程序的conf文件中的任何其他别名或目录真正使之前不同。
问题解决了!

before any other alias or directory in the application conf file really makes the difference. Problem solved!

这篇关于500内部服务器错误导入WSGI中一个Python模块时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆