2017-10-16 14 views
1

J'ai un script que j'utilise pour installer mon application sur une machine virtuelle en utilisant django 1.9.6 et mod_wsgi. Il a fonctionné correctement pendant au moins un an et après quelques mois je ne l'ai pas utilisé - il ne fonctionne soudainement pas. Je m'installe toujours sur une image fidèle d'Ubuntu propre et je n'ai fait aucun changement. Donc, je suppose que apt-get installe une version différente de libapache2-mod-wsgi maintenant.L'installation de Django et mod_wsgi a soudainement cessé de fonctionner

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 
... 

Lorsque je tente d'exécuter l'application serveur apache donne l'erreur:

[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 

J'espère résoudre sans changer quoi que ce soit, sauf le script d'installation et qui devrait fonctionner puisqu'il a travaillé auparavant.

Un conseil?

+0

Assurez-vous qu'il existe un fichier '__init __ .py' dans le répertoire où se trouve' wsgi.py'. c'est à dire 'cd /path/to/wsgi.py && touch __init __. py' – raratiru

+0

C'est là. Comme je l'ai dit, tout a fonctionné il y a un certain temps et je n'ai rien changé – user4421975

+0

Je vois trois points dans l'erreur que vous fournissez. Pourquoi donc? 'script WSGI cible '/ .../wsgi.py''. Ce n'est pas du tout normal. – raratiru

Répondre

2

Voir:

On dirait que vous avez installé une version plus récente du paquet qui a des exigences différentes pour la configuration et nécessite des packages supplémentaires à installer. Vous voudrez peut-être épingler le paquet à la même version que vous utilisiez précédemment car il se peut qu'il y ait d'autres changements à apporter à votre code et à votre base de données.

+0

Merci! 'sudo pip installer python-social-auth == 0.2.21' l'a fait – user4421975