Hello, 

Inside of Flask Python application I access MSSQL server like this:

cnxn = pyodbc.connect(appnmp.app.config['LYNCDB_CONNECTION_STRING'])
cursor = cnxn.cursor()
cursor.execute(...
... cursor.fetchall()
cursor.close()
cnxn.close()

I have no problem when running application like this:

#appnmp creation:
from flask import Flask
app = None
def init(_name):
# Call once only!
global app
app = Flask(_name)

#runserver:
import appnmp
import os
if __name__ == '__main__':
appnmp.app.run(port=int(os.getenv('FLASK_PORT', 5000)))

When I run the application as mod_wsgi inside the Apache, then the MSSQL 
connection seems to be shared among different requests. When I execute 2 
requests in parallel, then none of them get's data from database. The only 
help is to restart Apache. (And all is working fine including parallel 
requests when application runs outside apache with runserver as shown above)

This is the apache config file:

<VirtualHost *:443>
    ServerName czchols2643.prg-dc.dhl.com
    ServerAlias nmp.dhl.com
    ServerAdmin [email protected]

    LogLevel info
    ErrorLog /data/log/apache_error.log
    TransferLog /data/log/apache_access.log

    DocumentRoot /appl/nmp/app/appnmp/static

    <Directory "/appl/nmp/app/appnmp/static">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all

        AddOutputFilterByType DEFLATE application/javascript text/css 
text/plain
    </Directory>

    WSGIDaemonProcess appnmp user=apache group=apache processes=1
    WSGIScriptAlias / /appl/nmp/app/nmp.wsgi

    <Directory /appl/nmp/app>
        WSGIProcessGroup appnmp
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
    </Directory>

    <IfModule mod_headers.c>
        Header unset Server
        Header unset X-Powered-By
    </IfModule>

    SSLEngine on
    SSLCipherSuite 
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "/appl/nmp/home/nmp.dhl.com.crt"
    SSLCertificateKeyFile "/appl/nmp/home/nmp.dhl.com.key"

</VirtualHost>

Any idea please? It seems to me the db-connection object is somehow shared 
and different requests write to the same place in memory.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to