Reputation: 191
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 ("Hello World qwertyuiop!!")
if __name__ == "main":
app.run()
and the apache2 config is:
User daemon
Group daemon
</IfModule>
LoadFile "G:/Python3764/python37.dll"
LoadModule wsgi_module "G:/Python3764/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
WSGIPythonHome "G:/Python3764"
<VirtualHost *:80>
ServerName localhost:80
WSGIScriptAlias / "D:/WSGIAppDir/web.wsgi"
DocumentRoot "D:/WSGIAppDir"
<Directory "D:/WSGIAppDir">
Require all granted
</Directory>
</VirtualHost>
import sys
sys.path.insert(0, 'D:/WSGIAppDir')
from hello import app as application
Upvotes: 5
Views: 400
Reputation: 531
Add following line to the file sites-available/your-site.conf
WSGIApplicationGroup %{GLOBAL}
Upvotes: 3