IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Django Python Discussion :

AttributeError: module 'MySQLdb.constants.FIELD_TYPE' has no attribute 'JSON'


Sujet :

Django Python

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de Elwe31
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    487
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 487
    Par défaut AttributeError: module 'MySQLdb.constants.FIELD_TYPE' has no attribute 'JSON'
    Bonjour à tous,

    j'essaye d'installer mon projet sur un serveur apache, mais voila ce que me donne le log !
    Je ne pense pas les JSONField ?

    Debian 10 / Apache2

    /# python --version
    Python 3.7.3
    /# pip list
    Package Version
    ----------- --------
    asgiref 3.2.10
    Django 3.1.2
    jsonfield 3.1.0
    mysqlclient 2.0.1
    pip 20.2.4
    pytz 2020.1
    setuptools 41.2.0
    sqlparse 0.4.1
    uWSGI 2.0.19.1
    projet.conf
    <VirtualHost 192.168.1.151:80>
    ....
    <Directory /var/www/projet/projet1>
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>
    WSGIScriptAlias / /var/www/projet/projet1/wsgi.py
    </VirtualHost>

    Et voila le log du serveur :
    [Fri Oct 30 11:25:58.863600 2020] [wsgi:info] [pid 12708] [client 192.168.1.16:50270] mod_wsgi (pid=12708, process='', application='SERVEUR1|'): Loading Python script file '/var/www/projet/projet1/wsgi.py'.
    [Fri Oct 30 10:25:59.039756 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] mod_wsgi (pid=12708): Failed to exec Python script file '/var/www/projet/projet1/wsgi.py'.
    [Fri Oct 30 10:25:59.039810 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] mod_wsgi (pid=12708): Exception occurred processing WSGI script '/var/www/projet/projet1/wsgi.py'.
    [Fri Oct 30 10:25:59.041496 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] Traceback (most recent call last):
    [Fri Oct 30 10:25:59.041576 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/var/www/projet/projet1/wsgi.py", line 19, in <module>
    [Fri Oct 30 10:25:59.041581 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] application = get_wsgi_application()
    [Fri Oct 30 10:25:59.041587 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    [Fri Oct 30 10:25:59.041591 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] django.setup(set_prefix=False)
    [Fri Oct 30 10:25:59.041597 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/__init__.py", line 24, in setup
    [Fri Oct 30 10:25:59.041600 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] apps.populate(settings.INSTALLED_APPS)
    [Fri Oct 30 10:25:59.041606 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/apps/registry.py", line 114, in populate
    [Fri Oct 30 10:25:59.041609 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] app_config.import_models()
    [Fri Oct 30 10:25:59.041615 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/apps/config.py", line 211, in import_models
    [Fri Oct 30 10:25:59.041618 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] self.models_module = import_module(models_module_name)
    [Fri Oct 30 10:25:59.041624 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    [Fri Oct 30 10:25:59.041627 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] return _bootstrap._gcd_import(name[level:], package, level)
    [Fri Oct 30 10:25:59.041632 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
    [Fri Oct 30 10:25:59.041639 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
    [Fri Oct 30 10:25:59.041645 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
    [Fri Oct 30 10:25:59.041651 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
    [Fri Oct 30 10:25:59.041657 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
    [Fri Oct 30 10:25:59.041663 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    [Fri Oct 30 10:25:59.041669 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/contrib/auth/models.py", line 2, in <module>
    [Fri Oct 30 10:25:59.041672 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
    [Fri Oct 30 10:25:59.041678 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/contrib/auth/base_user.py", line 48, in <module>
    [Fri Oct 30 10:25:59.041682 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] class AbstractBaseUser(models.Model):
    [Fri Oct 30 10:25:59.041708 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/models/base.py", line 122, in __new__
    [Fri Oct 30 10:25:59.041712 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] new_class.add_to_class('_meta', Options(meta, app_label))
    [Fri Oct 30 10:25:59.041717 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/models/base.py", line 326, in add_to_class
    [Fri Oct 30 10:25:59.041721 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] value.contribute_to_class(cls, name)
    [Fri Oct 30 10:25:59.041727 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/models/options.py", line 206, in contribute_to_class
    [Fri Oct 30 10:25:59.041730 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
    [Fri Oct 30 10:25:59.041736 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/__init__.py", line 28, in __getattr__
    [Fri Oct 30 10:25:59.041739 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] return getattr(connections[DEFAULT_DB_ALIAS], item)
    [Fri Oct 30 10:25:59.041744 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/utils.py", line 214, in __getitem__
    [Fri Oct 30 10:25:59.041748 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] backend = load_backend(db['ENGINE'])
    [Fri Oct 30 10:25:59.041753 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/utils.py", line 111, in load_backend
    [Fri Oct 30 10:25:59.041757 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] return import_module('%s.base' % backend_name)
    [Fri Oct 30 10:25:59.041762 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    [Fri Oct 30 10:25:59.041766 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] return _bootstrap._gcd_import(name[level:], package, level)
    [Fri Oct 30 10:25:59.041771 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/backends/mysql/base.py", line 29, in <module>
    [Fri Oct 30 10:25:59.041774 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] from .introspection import DatabaseIntrospection # isort:skip
    [Fri Oct 30 10:25:59.041780 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/backends/mysql/introspection.py", line 16, in <module>
    [Fri Oct 30 10:25:59.041784 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] class DatabaseIntrospection(BaseDatabaseIntrospection):
    [Fri Oct 30 10:25:59.041789 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] File "/usr/local/lib/python3.7/dist-packages/django/db/backends/mysql/introspection.py", line 27, in DatabaseIntrospection
    [Fri Oct 30 10:25:59.041793 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] FIELD_TYPE.JSON: 'JSONField',
    [Fri Oct 30 10:25:59.041808 2020] [wsgi:error] [pid 12708] [client 192.168.1.16:50270] AttributeError: module 'MySQLdb.constants.FIELD_TYPE' has no attribute 'JSON'
    [Fri Oct 30 11:26:50.494367 2020] [reqtimeout:info] [pid 12710] [client 192.168.1.16:50271] AH01382: Request header read timeout
    merci pour votre aide.

  2. #2
    Membre éclairé Avatar de Elwe31
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    487
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 487
    Par défaut
    Il semblerait que cela soit un problème de version.
    Comment faire en sorte que le serveur exécute python3.8 et non 3.7 comme indiquer dans le log ?

    merci

  3. #3
    Membre éclairé Avatar de Elwe31
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    487
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Octobre 2004
    Messages : 487
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    sudo mv /usr/bin/python3.7 /root/python3.7.backup
    sudo ln -s /usr/local/bin/python3.8 /usr/bin/python3.7
    sans succes

Discussions similaires

  1. pyunit : AttributeError: (module) has no attribute 'runTest'
    Par Albre dans le forum Général Python
    Réponses: 9
    Dernier message: 05/03/2014, 14h59
  2. Réponses: 3
    Dernier message: 04/03/2014, 23h41
  3. AttributeError: 'module' object has no attribute 'ipv4_cksum
    Par comtention dans le forum Général Python
    Réponses: 6
    Dernier message: 05/10/2012, 19h09
  4. Selenium - AttributeError: 'module' object has no attribute
    Par bender1979 dans le forum Général Python
    Réponses: 4
    Dernier message: 09/11/2010, 23h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo