2017-04-25 127 views
0

我有IIS设置与fastCGI,服务烧瓶应用程序。到现在为止还挺好。接下来我想添加一些数据库连接,所以我添加import cx_Oracle行到我的应用程序。现在引发这个错误:wfastcgi失败导入cx_Oracle,但`python -c“导入cx_Oracle”成功

Error occurred while reading WSGI handler: 
Traceback (most recent call last): 
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 791, in main 
    env, handler = read_wsgi_handler(response.physical_path) 
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler 
    handler = get_wsgi_handler(os.getenv("WSGI_HANDLER")) 
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 616, in get_wsgi_handler 
    raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb)) 
ValueError: "Bloomberg_server.app" could not be imported: 

Traceback (most recent call last): 
File "D:\Anaconda2\lib\site-packages\wfastcgi.py", line 600, in get_wsgi_handler 
    handler = __import__(module_name, fromlist=[name_list[0][0]]) 
File "D:\website\init__.py", line 6, in import cx_Oracle 
    ImportError: DLL load failed: The specified module could not be found. StdOut: StdErr: 

正如标题所示,我无法在受控环境中重现问题。在conda环境中,相同的导入语句正常工作,而且我可以在依赖数据库连接的页面上运行Flask调试服务器。

我不知所措。谁知道这里发生了什么? path/oracle_home变量指向即时客户端,我只安装了一个python环境。

回答

0

我太尴尬承认这已经采取了多久,但我找到了答案。 FastCGI的核心业务是使子进程保持活动状态,以便后续对服务器的调用不需要引导Python环境。换句话说,安装一个python包后,建议重启。我通过重新启动解决了我的第一个问题。

this question的回答让我想到了正确的方向。