Graham
> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>
Graham
You can't set this on in WSGI script file as is too late. This
variable needs to be set at time process starts up.
If you have a standard Apache installation, then look for the
'envvars' file in same directory as Apache 'httpd' executable and add
to the 'envvars' file:
LD_LIBRARY_PATH='/opt/sqlanywhere12/lib32':$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
Alternatively, if you compiled the Python client module for pyodbc
yourself, then we can set an environment variable at the time you
compile it so the library directory is embedded in the client module
and therefore don't need to set it at run time.
> os.environ['PATH'] =os.environ['PATH']+':/opt/sqlanywhere12/
> bin32:/usr/local/sbin:/usr/local/bin:/usr/bin:/root/bin'
Not usually a good idea for a web application to be overriding PATH.
Code shouldn't be relying on picking up executables to be run from
PATH but should use absolute paths instead. In all probability this
isn't needed anyway, as code probably not trying to execute command
line applications.
> os.environ['SQLANY12'] ='/opt/sqlanywhere12'
> os.environ['SQLANYSAMP12'] ='/opt/sqlanywhere12/samples'
These are okay set like that.
Graham
Don't believe /etc/profile is used. If envvars doesn't exist, which
file you change depends on the platform.
Could be one of the follow:
/etc/sysconfig/httpd
/etc/init.d/httpd
/etc/init.d/apache
> SQLANY12="/opt/sqlanywhere12"
> export SQLANY12
>
> PATH="$SQLANY12/bin32:${PATH:-}"
> export PATH
> LD_LIBRARY_PATH="$SQLANY12/lib32:${LD_LIBRARY_PATH:-}"
> export LD_LIBRARY_PATH
>
>
> export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
> ------------------------------------------------------------
> my /etc/httpd/conf.d/wsgi.conf has
> LoadModule wsgi_module modules/mod_wsgi.so
>
> WSGIScriptAlias /myapp /var/www/wsgi-scripts/myapp.wsgi
> WSGIScriptAlias /wsgi /var/www/wsgi-scripts
> WSGIPythonPath /var/www/djangodeploy
Not needed since you are using daemon mode and using python-path
option to WSGIDaemonProcess.
> WSGIScriptReloading On
Not needed as is the default.
> #WSGIReloadMechanism Process
Not needed and newer mod_wsgi versions don't even recognise that directive.
SetEnv can be put in mod_wsgi but it only results in variables going
into per request environ and not os.environ.
It was a hack in mod_python Django adapter that SetEnv variables got
pushed to os.environ. It is actually really bad practice to update
os.environ on every request for a persistent process like Django was
doing in their mod_python adapter.
Graham
> logging os.environ returns {'LANG': 'C', 'CONSOLETYPE': 'vt', 'TERM':
> 'linux', 'SHLVL': '3', 'runlevel': '5', 'UPSTART_EVENTS': 'runlevel',
> 'PREVLEVEL': 'N', 'LANGSH_SOURCED': '1', 'UPSTART_INSTANCE': '', 'PWD': '/',
> 'RUNLEVEL': '5', 'UPSTART_JOB': 'rc', 'PATH':
> '/sbin:/usr/sbin:/bin:/usr/bin', 'HOME': '/var/www', '_': '/usr/sbin/httpd',
> 'previous': 'N'}
> even after a brute force attempt in my wsgi script as follows:
> os.environ['SQLANY12'] = '/opt/sqlanywhere12'
> os.environ['PATH'] = '/opt/sqlanywhere12/bin32:'+os.environ['PATH']
> os.environ['LD_LIBRARY_PATH'] =
> '/opt/sqlanywhere12/lib32:'+os.environ['LD_LIBRARY_PATH']
>
>
> I't apparent that I'm failing to set the environment variables when running
> as Apache.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/qLeOsHe3ES4J.
Don't believe /etc/profile is used. If envvars doesn't exist, which file you change depends on the platform
Could be one of the follow:
/etc/sysconfig/httpd it was this one for RHEL/Centos.
/etc/init.d/httpd
/etc/init.d/apache
In all my trial and error I've got multiple .odbc.ini files scattered about. I'll start deleting those one by one to verify which one ( /var/www I think) is the right one.--
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 modwsgi+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.