借鉴Blog Link:http://www.lizenghai.com/archives/852.html
最近在做Django项目的Docker化,启用容器内的Apache来部署。
按照以往的经验部署后,发现外网能进入容器内部,但是就是请求接口的时候,一直处于加载状态。
请运维同事来查看后,说我的Apache配置没有问题,只能是我的WSGI可能会有问题。
我又排查了好多次,还是不行,最后耐着性子,一遍一遍百度,终于发现了问题。
是因为我项目使用了:
import pandas as pd
and
import numpy as np
具体原因,应该叫:Import Pandas on apache server causes timeout error
解决方法也很简单:
而解决办法很简单,就是在Apache的conf配置文件中增加一句话:
WSGIApplicationGroup %{GLOBAL}
解释如下:
Various of the scientific packages that it is going to need will not work in Python sub interpreters. That directive will force the use of the main interpreter context.