本文介绍了无法同时在类加载外部模块加载到Apache服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的Django项目层次

This is my django project hierarchy

project/
       apache/ django.wsgi
       project/ __init__.py, settings.py, urls.py ..
       pages/
             __init__.py
             widgets.py
             website_views.py
       services/
               __init__.py
               apis/
                    __init__.py
                    fparser.py
                    googleData.py
                    wp.py
                    ...
               wservice.py
       ...

因此​​, wservice.py 是总结状类,它坐落在的API 模块的所有课程。它甚至还提供了一些常用功能的所有类,继承它。

So, the wservice.py is wrap-up like class which lies over all classes of apis module. It even provides some common functionality all classes that it inherit.

wservice.py

import feedparser
from bs4 import BeautifulSoup

class WidgetService(FParser):
    def post_content_summary(self, post_number):
        ....
        content_text = content_soup.get_text()

        ...

    def get_random_image(self, post_number):
        ...
        content_soup = BeautifulSoup(html_content)

        ...

FParser 类位于 fparser.py

fparser.py 的方法使用上面的类这种方式。

The methods in fparser.py use the above class in this way.

from services.wservice import WidgetService
def method1():
    obj = WidgetService()
    m1 = obj.foo1() # described in FParser class
    m2 = obj.foo2() # described in WidgetService class

我在页/ widgets.py 使用此WidgetService()。所以,我发现的是,当过我开始使用 BeautifulSoup ,Apache服务器没有加载。其甚至没有表现出任何语法错误。

I am using this WidgetService() in pages/widgets.py. So, what I found is, when ever I start using BeautifulSoup, the apache server is not loading.. Its not even showing any syntax error.

我甚至不看日志文件中的任何错误。

I don't even see any error in log file.

什么可能都有可能出了问题?有趣的是,我还没有遇到这样那样的错误在开发服务器,Heroku的(gunicorn)

What might have possibly went wrong??? The interesting part is, I haven't faced this kind of error in development server, heroku (gunicorn)

推荐答案

这可能是描述用Cython和mod_wsgi的之间的相互作用。这里的an早期的问题类似你。

This may be the interaction between Cython and mod_wsgi described here, and explored in a Beautiful Soup context here. Here's an earlier question similar to yours.

这篇关于无法同时在类加载外部模块加载到Apache服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 07:40