Django自带测试服务器可以正常启动,使用UWSGI启动则显示Sqlite3版本过低,应该如何解决?
问题描述
想部署一个uwsgi+django的项目,用Django自带服务器启动时状况向好
问题出现的环境背景及自己尝试过哪些方法
阿里云轻量应用服务器,CentOS7系统,自带Python2和低版本Sqlite3,自行安装了Python3和Sqlite3.32.
在命令行中使用Sqlite3 --version 查询版本显示3.32,正常
使用Python3 manage.py runserver 直接运行django正常
使用uwsgi --http :8000 --module xxxx.wsgi启动时报错
显示Sqlite版本过低,uwsgi找不到新版本的sqlite3吗?怎么办?
相关代码
直接启动正常
[root@izuf667d5ry663qnarvjvmz umbike_old]# python3 manage.py runserver 0.0.0.0:1234
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 21, 2020 - 05:43:59
Django version 3.0.8, using settings 'umbike.settings'
Starting development server at http://0.0.0.0:1234/
Quit the server with CONTROL-C.
Sqlite3 版本查询正常
[root@izuf667d5ry663qnarvjvmz umbike_old]# sqlite3 --version
3.32.3 2020-06-18 14:00:33 7ebdfa80be8e8e73324b8d66b3460222eb74c7e9dfd655b48d6ca7e1933cc8fd
uwsgi启动报错,显示只找到3.7.17版本
[root@izuf667d5ry663qnarvjvmz umbike_old]# uwsgi --http :1234 --module umbike.wsgi
*** Starting uWSGI 2.0.19.1 (64bit) on [Tue Jul 21 13:53:37 2020] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-39) on 06 July 2020 15:25:29
os: Linux-3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020
nodename: izuf667d5ry663qnarvjvmz
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /root/umbike_old
detected binary path: /usr/local/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) ***
*** WARNING: you are running uWSGI without its master process manager ***
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 :1234 fd 4
spawned uWSGI http 1 (pid: 29287)
uwsgi socket 0 bound to TCP address 127.0.0.1:43799 (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 threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x2294700
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72904 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
File "./umbike/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/usr/local/lib64/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/usr/local/lib64/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib64/python3.6/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/usr/local/lib64/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 "/usr/local/lib64/python3.6/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/usr/local/lib64/python3.6/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/usr/local/lib64/python3.6/site-packages/django/db/models/base.py", line 121, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/usr/local/lib64/python3.6/site-packages/django/db/models/base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "/usr/local/lib64/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 "/usr/local/lib64/python3.6/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/usr/local/lib64/python3.6/site-packages/django/db/utils.py", line 207, in __getitem__
backend = load_backend(db['ENGINE'])
File "/usr/local/lib64/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 "/usr/local/lib64/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 68, in <module>
check_sqlite_version()
File "/usr/local/lib64/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 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 ***
spawned uWSGI worker 1 (and the only) (pid: 29286, cores: 1)
网上搜索了大量例如软连接python到python3之类的方法都没有奏效,望大佬赐教。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
楼主这个问题解决了吗,我也遇到了