How to use pytorch in flask and run it on wsgi_mod for apache2
I'm trying to run a flask app with apache in wsgi_mod
As Describe in following link
https://pytorch.org/tutorials/recipes/deployment_with_flask.html
i configure my app for working with pytorch
when my app tries to
import torchvision
it hangs with no error log.
Is there any way to fix this issue?
the main python code is:
import torchvision.models as models
import torchvision.transforms as transforms
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
    return (&quot;Hello World qwertyuiop!!&quot;)
if __name__ == &quot;main&quot;:
    app.run()


and the apache2 config is:
User daemon
Group daemon

&lt;/IfModule&gt;

LoadFile &quot;G:/Python3764/python37.dll&quot;
LoadModule wsgi_module &quot;G:/Python3764/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd&quot;
WSGIPythonHome &quot;G:/Python3764&quot;


&lt;VirtualHost *:80&gt;
    ServerName localhost:80
    WSGIScriptAlias / &quot;D:/WSGIAppDir/web.wsgi&quot;  
    DocumentRoot &quot;D:/WSGIAppDir&quot;
    &lt;Directory &quot;D:/WSGIAppDir&quot;&gt;     
        Require all granted 
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;

import sys
sys.path.insert(0, 'D:/WSGIAppDir')
from hello import app as application



Add following line to the file sites-available/your-site.conf
WSGIApplicationGroup %{GLOBAL}  

