问题
To elaborate a little more from the title, I'm having issues importing nltk to use in a django web app. I've deployed the web app on an apache2 server. When I import nltk in views.py, the web page refuses to load and eventually times out after a few minutes of loading. I've installed nltk using pip. I've used pip to install a number of other python packages which I've been able to reference without issue within django.
I haven't been able to find anything solid to explain why this would be happening. Here's what I'm working with
- Server OS: Ubuntu 14.04
- Python: 2.7.6
- Django: 1.8.2
- Apache Webserver: 2.4.7
Like I said, I haven't been able to find any good reasons for this so please feel free to ask for any other information you need.
Thanks!
回答1:
I am using the same web-stack as you and I had the exact same problem.
You need to set WSGIApplicationGroup to %{GLOBAL} in your site's Apache config file
WSGIApplicationGroup %{GLOBAL}
来源:https://stackoverflow.com/questions/30715896/django-webapp-on-an-apache2-server-hangs-indefintely-when-importing-nltk-in-vi