无法建立连接:通过 mod_wsgi 的 HTSQL(未找到文件)

Cant establish connection: HTSQL via mod_wsgi (file not found)

我想在 apache[= 上集成 HTSQL 49=] 服务器使用 mod_wsgi。 apache 和 mod_wsgi 均已成功配置,hello world python 脚本执行并运行!

但是,当我尝试 运行 HTSQL python 脚本(名为 htsql_wsgi.py 并使用这些指令时:http://htsql.org/doc/admin/deploy.html ),我收到 500 内部服务器错误。你能给我一个解决方案吗?

Apache 错误日志显示:

[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1] mod_wsgi (pid=5760): Target WSGI script 'C:/MAMP/scripts/htsql_wsgi.py' cannot be loaded as Python module.
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1] mod_wsgi (pid=5760): Exception occurred processing WSGI script 'C:/MAMP/scripts/htsql_wsgi.py'.
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1]   File "C:/MAMP/scripts/htsql_wsgi.py", line 8, in <module>
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1]     application = HTSQL(DB)
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1]   File "C:\MAMP\bin\python\lib\site-packages\htsql\core\application.py", line 186, in __init__
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1]     % (addon.name, exc))
[Wed Apr 13 16:26:29 2016] [error] [client 127.0.0.1] ImportError: failed to initialize 'htsql': failed to establish database connection: file does not exist: htsql_demo.sqlite

我已经尝试过的事情:

  1. 直接在 Linux(目前正在处理 MAMP)上工作时出现复制错误

  2. 直接通过 python(cmd 和 xUbuntu 终端)在托管在同一文件(htsql_demo.sqlite)上成功执行脚本 同一台服务器。

  3. 使用权限播放(将 777 设置为包含 htsql_demo.sqlite 的文件夹)

  4. 使用 httpd.conf 权限进行游戏(使用目录、文件、位置更改设置)

使用 MAMP(Windows 7、Apache 2.2.、Python 2.7.)或 xUbuntu(Apache 2.4.、Python 2.7.)时出现问题。在两台机器上,错误是一样的。

非常感谢您的建议

问题在于定义绝对路径。而不是“:”应该使用“%3A” 因此正确的路径是:

'sqlite:///C%3A/MAMP/Scripts/htsql_demo.sqlite'