【问题标题】:wfastcgi fails import cx_Oracle, but `python -c "import cx_Oracle" succeedswfastcgi 导入 cx_Oracle 失败,但 `python -c "import cx_Oracle" 成功
【发布时间】:2017-09-22 03:58:58
【问题描述】:

我使用 fastCGI 设置了 IIS,为烧瓶应用程序提供服务。到目前为止,一切都很好。接下来我想添加一些数据库连接,所以我将import 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: 

正如标题所示,我无法在受控环境中重现该问题。同样的 import 语句在 conda 环境中运行良好,此外,我可以在依赖数据库连接的页面上运行 Flask 调试服务器。

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

【问题讨论】:

    标签: python iis flask cx-oracle wfastcgi


    【解决方案1】:

    我不好意思承认这花了我多长时间,但我找到了答案。 FastCGI 的核心业务是使子进程保持活动状态,以便对服务器的后续调用不需要启动 Python 环境。换句话说,安装 python 包后建议重新启动。我通过重启解决了我关于 SO 的第一个问题..

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

    【讨论】:

      猜你喜欢
      • 2018-02-14
      • 1970-01-01
      • 2021-02-28
      • 1970-01-01
      • 1970-01-01
      • 2014-06-17
      • 2018-08-03
      • 2011-12-30
      • 2011-06-28
      相关资源
      最近更新 更多