我有一个脚本,用于使用django 1.9.6
和mod_wsgi
在虚拟机上安装我的应用程序。它用于工作至少一年,然后几个月后我没有使用它 - 它突然不起作用。我总是在一个干净的ubuntu可靠图像上安装,我没有做任何改变。所以我的猜测是apt-get
现在正在安装libapache2-mod-wsgi
的不同版本。
sudo apt-get update
sudo apt-get install -y python-pip
sudo pip install django=1.9.6
sudo pip install python-social-auth
sudo apt-get -y install apache2 libapache2-mod-wsgi
...
当我尝试运行应用程序时,apache服务器会出错:
[Tue Oct 17 11:52:29.184072 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] mod_wsgi (pid=8178): Target WSGI script '/root/geosearch_app/geosearch_project/geosearch_project/wsgi.py' cannot be loaded as Python module.
[Tue Oct 17 11:52:29.184116 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] mod_wsgi (pid=8178): Exception occurred processing WSGI script '/root/geosearch_app/geosearch_project/geosearch_project/wsgi.py'.
[Tue Oct 17 11:52:29.184140 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] Traceback (most recent call last):
[Tue Oct 17 11:52:29.184159 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/root/geosearch_app/geosearch_project/geosearch_project/wsgi.py", line 16, in <module>
[Tue Oct 17 11:52:29.184212 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] application = get_wsgi_application()
[Tue Oct 17 11:52:29.184225 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Tue Oct 17 11:52:29.184266 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] django.setup()
[Tue Oct 17 11:52:29.184280 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
[Tue Oct 17 11:52:29.184327 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] apps.populate(settings.INSTALLED_APPS)
[Tue Oct 17 11:52:29.184339 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
[Tue Oct 17 11:52:29.184458 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] app_config.import_models(all_models)
[Tue Oct 17 11:52:29.184471 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
[Tue Oct 17 11:52:29.184549 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] self.models_module = import_module(models_module_name)
[Tue Oct 17 11:52:29.184561 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
[Tue Oct 17 11:52:29.184738 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] __import__(name)
[Tue Oct 17 11:52:29.184751 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/default/models.py", line 1, in <module>
[Tue Oct 17 11:52:29.184791 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] from social_django.models import AbstractUserSocialAuth, UserSocialAuth, Nonce, Association, Code, DjangoStorage
[Tue Oct 17 11:52:29.184819 2017] [:error] [pid 8178:tid 140000402241280] [remote 131.111.64.116:33385] ImportError: No module named social_django.models
[Tue Oct 17 11:52:29.289697 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] mod_wsgi (pid=8178): Target WSGI script '/root/geosearch_app/geosearch_project/geosearch_project/wsgi.py' cannot be loaded as Python module.
[Tue Oct 17 11:52:29.289725 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] mod_wsgi (pid=8178): Exception occurred processing WSGI script '/root/geosearch_app/geosearch_project/geosearch_project/wsgi.py'.
[Tue Oct 17 11:52:29.289745 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] Traceback (most recent call last):
[Tue Oct 17 11:52:29.289768 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] File "/root/geosearch_app/geosearch_project/geosearch_project/wsgi.py", line 16, in <module>
[Tue Oct 17 11:52:29.289799 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] application = get_wsgi_application()
[Tue Oct 17 11:52:29.289809 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Tue Oct 17 11:52:29.289827 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] django.setup()
[Tue Oct 17 11:52:29.289836 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
[Tue Oct 17 11:52:29.289850 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] apps.populate(settings.INSTALLED_APPS)
[Tue Oct 17 11:52:29.289859 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate
[Tue Oct 17 11:52:29.289873 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] raise RuntimeError("populate() isn't reentrant")
[Tue Oct 17 11:52:29.289891 2017] [:error] [pid 8178:tid 140000419026688] [remote 131.111.64.116:24169] RuntimeError: populate() isn't reentrant
我希望在没有实际更改安装脚本以外的任何内容的情况下解决此问题,并且应该可以正常工作,因为它之前有效。
有什么建议吗?
答案 0 :(得分:2)
请参阅:
您似乎安装了较新版本的软件包,该软件包具有不同的安装要求,需要安装额外的软件包。
您可能希望将软件包固定为您之前使用的旧版本,否则您可能需要对代码和数据库进行其他更改。