Forum

You are not logged in.

#1 26-12-2017 20:21:48

yaute
Membre
Registered: 26-12-2017
Posts: 3

[Résolu] Site WSGI et Django

Bonjour,

Je viens de créer un site wsgi afin d'utiliser django.
J'ai suivi ces instructions https://help.alwaysdata.com/languages/python/django mais ça ne fonctionne pas.
Le navigateur me renvoit "Échec de la connexion sécurisée".
Dans les logs j'ai:

** Starting uWSGI 2.0.15 (64bit) on [Tue Dec 26 20:06:56 2017] ***
compiled with version: 4.9.2 on 05 May 2017 10:42:53
os: Linux-4.9.59-alwaysdata #1 SMP Mon Oct 30 09:50:49 UTC 2017
nodename: http7
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 12
current working directory: /home/xxx
detected binary path: /usr/alwaysdata/uwsgi/2.0.15/bin/uwsgi
*** dumping internal response routing table ***
[rule: 0] subject: ${X_SENDFILE} func: !empty action: fastfile:filename=${X_SENDFILE}
*** end of the internal response routing table ***
pulling header X-Sendfile to var X_SENDFILE
chdir() to /home/xxx/bqapp
your processes number limit is 257245
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
building mime-types dictionary from file /etc/mime.types...547 entry found
lock engine: pthread robust mutexes
thunder lock: enabled
[busyness] settings: min=10%, max=90%, overload=5, multiplier=10, respawn penalty=2
[busyness] backlog alert is set to 33 request(s), step is 1
[busyness] backlog non-zero alert is set to 60 second(s)
uwsgi socket 0 bound to TCP address 127.2.80.73:8100 fd 3
Python version: 3.6.3 (default, Nov 16 2017, 09:34:40)  [GCC 4.9.2]
PEP 405 virtualenv detected: /home/xxx/bqenv
Set PythonHome to /home/xxx/bqenv
Python main interpreter initialized at 0xce6250
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1115752 bytes (1089 KB) for 10 cores
*** Operational MODE: preforking ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 563896)
spawned uWSGI worker 1 (pid: 563902, cores: 1)
spawned 1 offload threads for uWSGI worker 1
Traceback (most recent call last):
  File "/home/xxxxx/bqapp/bqapp/wsgi.py", line 12, in <module>
    from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. GAME OVER ***
SIGINT/SIGQUIT received...killing workers...
OOPS ! failed loading app in worker 1 (pid 563902)
Tue Dec 26 20:06:57 2017 - need-app requested, destroying the instance...
goodbye to uWSGI.

Pourquoi cette erreur 'ModuleNotFoundError: No module named 'django'' alors que django est installé ?

J'ai fait le même test en local sur mon linux et ça fonctionne, du coup je séche.

Merci pour votre aide
yaute

Last edited by yaute (29-12-2017 21:32:42)

Offline

#2 27-12-2017 09:36:36

@Cyril
Staff
From: Paris
Registered: 06-02-2007
Posts: 5,587
Website

Re: [Résolu] Site WSGI et Django

Bonjour,

Django n'est pas installé dans le virtualenv que vous avez indiqué.

Offline

#3 27-12-2017 20:15:00

yaute
Membre
Registered: 26-12-2017
Posts: 3

Re: [Résolu] Site WSGI et Django

J'ai modifier les path de la log ci dessus.

Il est bien installé ou j'ai raté un truc:

$ python -m venv bqenv
$ pip install django
Requirement already satisfied: django in /home/yaute/.local/lib/python3.6/site-packages
Requirement already satisfied: pytz in /home/yaute/.local/lib/python3.6/site-packages (from django)
$ 

Offline

#4 29-12-2017 08:43:20

@Cyril
Staff
From: Paris
Registered: 06-02-2007
Posts: 5,587
Website

Re: [Résolu] Site WSGI et Django

Vous créez un virtualenv (première ligne), mais ne l'activez pas. Donc lorsque vous utilisez pip ensuite (seconde ligne), il installe Django « globalement », pas dans le virtualenv.

Offline

#5 29-12-2017 21:31:45

yaute
Membre
Registered: 26-12-2017
Posts: 3

Re: [Résolu] Site WSGI et Django

Merci smile

Offline

Board footer

Powered by FluxBB