Shruti Mittal Shruti Mittal - 2 months ago 52
Apache Configuration Question

Deploy keras (with theano backend) on a LAMP (python) stack with flask?

I am trying to deploy a Flask web app with keras and theano on compute engine.
When I

import keras

and run sudo service apache2 restart, the server goes into a loop ("waiting for IP address").
The error.log gives the following error

[:error] [pid 1588:tid 140666780755712] Using Theano backend.


I am on ubuntu 14.04

Answer

I got keras working on compute engine. To import heavy libraries we need to set certain parameters in .conf file.

Add the following code to your /etc/apache2/sites-enables/yourapp.conf file:

WSGIDaemonProcess yourapp user=you group=somegroup processes=1 threads=5
<Directory /home/directory/to/webserver/html/appdir/app.wsgi>
    WSGIProcessGroup %{GLOBAL}
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory> 

Refer this link for details - http://cmry.github.io/notes/bottle