zoukankan      html  css  js  c++  java
  • centos7在虚拟环境中使用uwsgi --ini test.ini启动项目的时候,报错

    centos7在虚拟环境中使用uwsgi --ini test.ini启动项目的时候,报错

    报错

     [root@djc_nb my_app01]# uwsgi --ini test.ini 
    [uWSGI] getting INI configuration from test.ini
    *** Starting uWSGI 2.0.18 (64bit) on [Thu May 28 16:14:01 2020] ***
    compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-39) on 27 May 2020 10:22:08
    os: Linux-3.10.0-1062.18.1.el7.x86_64 #1 SMP Tue Mar 17 23:49:17 UTC 2020
    nodename: djc_nb
    machine: x86_64
    clock source: unix
    detected number of CPU cores: 1
    current working directory: /data/my_app01
    detected binary path: /root/.virtualenvs/v1/bin/uwsgi
    !!! no internal routing support, rebuild with pcre support !!!
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
    chdir() to /data/my_app01
    your processes number limit is 7270
    your memory page size is 4096 bytes
    detected max file descriptor number: 65535
    lock engine: pthread robust mutexes
    thunder lock: disabled (you can enable it with --thunder-lock)
    uWSGI http bound on 0.0.0.0:9001 fd 4
    uwsgi socket 0 bound to TCP address 127.0.0.1:42451 (port auto-assigned) fd 3
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
    Python version: 3.6.8 (default, Apr  2 2020, 13:34:55)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
    Python main interpreter initialized at 0x7918c0
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
    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 3568896 bytes (3485 KB) for 256 cores
    *** Operational MODE: preforking+threaded ***
    Traceback (most recent call last):
      File "./my_app01/wsgi.py", line 26, in <module>
        application = get_wsgi_application()
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
        django.setup(set_prefix=False)
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
        apps.populate(settings.INSTALLED_APPS)
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
        app_config.import_models()
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models
        self.models_module = import_module(models_module_name)
      File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
        from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
        class AbstractBaseUser(models.Model):
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/models/base.py", line 117, in __new__
        new_class.add_to_class('_meta', Options(meta, app_label))
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/models/base.py", line 321, in add_to_class
        value.contribute_to_class(cls, name)
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/models/options.py", line 204, in contribute_to_class
        self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/__init__.py", line 28, in __getattr__
        return getattr(connections[DEFAULT_DB_ALIAS], item)
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/utils.py", line 201, in __getitem__
        backend = load_backend(db['ENGINE'])
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/utils.py", line 110, in load_backend
        return import_module('%s.base' % backend_name)
      File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 36, in <module>
        raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
    django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
    unable to load app 0 (mountpoint='') (callable not found or import error)
    *** no app loaded. going in full dynamic mode ***
    uWSGI running as root, you can use --uid/--gid/--chroot options
    *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
    *** uWSGI is running in multiple interpreter mode ***

    报错原因

      File "/root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 36, in <module>
        raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
    django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

    解决方法

    找到报错行

    vim  /root/.virtualenvs/v1/lib/python3.6/site-packages/django/db/backends/mysql/base.py

    将报错行注释掉

    version = Database.version_info
    #if version < (1, 3, 13):
     #   raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
     
  • 相关阅读:
    [SQL]触发器把自增ID的值赋值给另外一个字段
    [SQL]T-Sql 递归查询(给定节点查所有父节点、所有子节点的方法)
    [二维码开发]二维码开发入门级demo
    [sql]sql函数coalesce返回第一个非空的值
    [编程小技巧]Notepad++中如何实现文本对比功能?
    [ExcelHome]VLOOKUP的别样用法
    [ExcelHome]15个常用的Excel函数公式,拿来即用
    [ExcelHome]学习Excel的网站
    Permutations
    Remove Duplicates from Sorted List II
  • 原文地址:https://www.cnblogs.com/wangkun122/p/12981636.html
Copyright © 2011-2022 走看看