Search code examples
linuxmod-wsgiwsgipython-3.4pymssql

can not connect to pymssql from python wsgi with mod_wsgi


I am new in wsgi , and now i can not connect to pymssql , after a while this line appear to error.log:

[Mon Feb 02 16:12:06.629874 2015] [wsgi:info] [pid 12257] [client 127.0.0.1:48500] mod_wsgi (pid=12257, process='', application='Alireza.FY|/ii'): Loading WSGI script '/var/www/wsgi/scr.wsgi'., referer: http://localhost/ii

and nothing happened after this line of code:

config = dict(
server="xxx.xxx.xxx.xxx",
port=1433,
user="user",
password="123",
database="testdb"
)
db = pymssql.connect(**config)

i can connect to sqlite3 very easy without any problem! why is that happen in wsgi ? thanks.

python 3.4.2

libapache2-mod-wsgi-py3 4.3.0.1

pymssql (2.1.1)


Solution

  • I find a solution for this problem and this is reason : ( https://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API , https://groups.google.com/d/msg/modwsgi/0upGl6JqsLo/OH-G1mGtohwJ )

    I easily added this line to my apache conf :

    WSGIApplicationGroup %{GLOBAL}