Django和uWSGI配置不正确的问题(需要SQLite 3.8.3或更高版本)

问题描述 投票:0回答:1

我已经阅读了一些有关“ SQLite 3.8.3或更高版本是必需的”问题的文章,通常是关于旧的sqlite3版本的问题,可以通过使用LD_LIBRARY_PATH=new/installed/sqlite3安装最新版本来解决。

嗯,它确实部分解决了我的问题。完成上述过程后,我确实成功运行了python3 manage.py runserver。但是,当我将项目移至uwsgi时,我得到了django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).

跟随我的uWSGI shell cmd:

uwsgi --http :8000 --pythonpath /mnt/datasource/<privacy_hidden>/venv/bin/python3  --virtualenv=/mnt/datasource/app-repos-management/back/venv  --wsgi-file delivery/wsgi.py --master --processes 4 --threads 4

相对输出是:

*** Starting uWSGI 2.0.18 (64bit) on [Mon Mar  2 16:55:39 2020] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-39) on 02 March 2020 08:43:11
os: Linux-3.10.0-1062.4.3.el7.x86_64 #1 SMP Wed Nov 13 23:58:53 UTC 2019
nodename: localhost.localdomain
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /mnt/datasource/<privacy_hidden>
detected binary path: /home/user/.local/bin/uwsgi
your processes number limit is 31049
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8000 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:45914 (port auto-assigned) fd 3
Python version: 3.6.8 (default, Aug  7 2019, 17:28:10)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
PEP 405 virtualenv detected: /mnt/datasource/<privacy_hidden>/venv
Set PythonHome to /mnt/datasource/<privacy_hidden>/venv
Python main interpreter initialized at 0x19e8e70
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 521440 bytes (509 KB) for 16 cores
*** Operational MODE: preforking+threaded ***
added /mnt/datasource/<privacy_hidden>/venv/bin/python3 to pythonpath.
Traceback (most recent call last):
  File "delivery/wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/mnt/datasource/<privacy_hidden>/venv/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 "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
    class AbstractBaseUser(models.Model):
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/models/base.py", line 121, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/models/base.py", line 325, in add_to_class
    value.contribute_to_class(cls, name)
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/models/options.py", line 208, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/__init__.py", line 28, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/utils.py", line 207, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/utils.py", line 111, 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 "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 68, in <module>
    check_sqlite_version()
  File "/mnt/datasource/<privacy_hidden>/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 65, in check_sqlite_version
    raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 81912)
spawned uWSGI worker 1 (pid: 81914, cores: 4)
spawned uWSGI worker 2 (pid: 81915, cores: 4)
spawned uWSGI worker 3 (pid: 81919, cores: 4)
spawned uWSGI worker 4 (pid: 81923, cores: 4)
spawned uWSGI http 1 (pid: 81927)

btw,我的sqlite3.sql_version测试是'3.31.1',任何建议都很棒Suggest。

django sqlite uwsgi
1个回答
0
投票
相同的问题,我发现它是在升级SQLite3之后,用较新的版本替换系统默认的SQLite3。
© www.soinside.com 2019 - 2024. All rights reserved.