Dfinzgar
Dfinzgar

Reputation: 88

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

I would like to integrate HTSQL on apache server using mod_wsgi. Both apache and mod_wsgi were successfully configured, hello world python script executes and works!

However, when I try to run HTSQL python script (named htsql_wsgi.py and using these instructions: http://htsql.org/doc/admin/deploy.html), I get a 500 Internal Server Error. Can you suggest me a solution?

Apache error log shows:

[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

Things I've already tried:

  1. Replicate error working directly on Linux (currently working on MAMP)

  2. Successfully execute script directly via python (both cmd and xUbuntu terminal) on the same file (htsql_demo.sqlite) hosted on the same server.

  3. Play with the permissions (set 777 to folder containing htsql_demo.sqlite)

  4. Play with permissions on httpd.conf (changing settings using directory, files, locations)

Problem occurs using MAMP (Windows 7, Apache 2.2., Python 2.7.) or xUbuntu (Apache 2.4., Python 2.7.). On both machines, the error is the same.

Many thanks for your suggestions

Upvotes: 1

Views: 174

Answers (1)

Dfinzgar
Dfinzgar

Reputation: 88

The problem was with defining the absolute path. Instead of ":" one should use "%3A" therefore the correct path would be:

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

Upvotes: 0

Related Questions