1

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

但是,当我尝试运行 HTSQL python 脚本(名为htsql_wsgi.py并使用以下说明:http ://htsql.org/doc/admin/deploy.html )时,我收到500 Internal Server Error。你能建议我一个解决方案吗?

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. 在同一服务器上托管的同一文件(htsql_demo.sqlite)上直接通过 python(cmd 和 xUbuntu 终端)成功执行脚本。

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

  4. 使用 httpd.conf 上的权限(使用目录、文件、位置更改设置)

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

非常感谢您的建议

4

1 回答 1

0

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

'sqlite:///C%3A/MAMP/Scripts/htsql_demo.sqlite'
于 2016-04-21T16:09:57.793 回答