Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy doesn't apache load my .so libraries when I try to run my flask application?
    primarykey
    data
    text
    <p>I have a developed flask application which runs successfully on flask's embedded server. The application uses a backend written in C++. The libraries for my C++ backend are in this folder:</p> <blockquote> <p>/home/(USER_NAME)/rf/Dev/Backend/lib/libtestCAF.so</p> </blockquote> <p>When I run the application on the embedded server, it finds the C++ backend code and uses it to generate reports. However, when I run the same application on apache, I get this error trace:</p> <pre><code>[Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] from main.main import main [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] File "/home/(USER_NAME)/rf/Dev/Web/main/main.py", line 19, in &lt;module&gt; [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] from CAF.CAFWrapper import * [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] File "/home/admin1/rf/Dev/Web/CAF/CAFWrapper.py", line 12, in &lt;module&gt; [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] lib = cdll.LoadLibrary('../Backend/lib/libtestCAF.so') [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] return self._dlltype(name) [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__ [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] self._handle = _dlopen(self._name, mode) [Thu Jul 11 14:44:54 2013] [error] [client 127.0.0.1] OSError: ../Backend/lib/libtestCAF.so: cannot open shared object file: No such file or directory </code></pre> <p>As you can see on that last line, it says that libtestCAF.so doesn't exist. Meanwhile, the embedded server always finds it. </p> <p>I use mod_wsgi to run the flask application on the apache server. The WSGI file I use is in this folder:</p> <pre><code>/home/(USER_NAME)/rf/Dev/Web/wsgi/rf.wsgi </code></pre> <p>... and it says this:</p> <pre><code>import sys sys.path.insert(0,'home/(USER_NAME)/rf/Dev/Web') from runserver import app as application </code></pre> <p>This is my apache config file:</p> <pre><code>&lt;VirtualHost *:8100&gt; ServerName www.relativefinder.com WSGIDaemonProcess rf user=www-data group=www-data threads=5 WSGIScriptAlias / /home/(USER_NAME)/rf/Dev/Web/wsgi/rf.wsgi &lt;Directory /home/(USER_NAME)/rf/Dev&gt; WSGIProcessGroup rf WSGIApplicationGroup %{GLOBAL} Options Indexes FollowSymLinks MultiViews Order deny,allow Allow from all &lt;/Directory&gt; &lt;/VirtualHost&gt; </code></pre> <p>The python file which loads the .so files uses the following code:</p> <pre><code>if SettingsToUse == DEV_CAF: lib = cdll.LoadLibrary('../Backend/lib/librelativefinder.so') else: lib = cdll.LoadLibrary('../Backend/lib/libtestCAF.so') </code></pre> <p>I'm quite confused that Apache doesn't seem to find it but the embedded server in flask always appears to find it. What do I need to do so that, when I run apache, it will find that .so file?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload