简体   繁体   中英

sqlite3 works well in centos7 and python shell,but can't work in Uwsgi

I have a question need your help~

I have a django program run in a vps(centos7,django2.2),it works well with Nginx+Uwsgi.

I edit three files(like a.py b.py c.py),and upload to the vps by winscp.exe,the program can't work now.

I found these logs in the uwsgi.log file.

  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)

I wrote "sqlite3 --version" in centos7 shell, it show version = 3.30.1

I wrote "python >>> import sqlite3 >>>print sqlite3.sqlite_version" it show version=3.30.1

I wrote "python manage.py runserver --noreload 0.0.0.0:80",it works well, no info show sqlite error.

But the program can't work in uwsgi,I think the uwsgi.ini is correct.

What can I do? Thank you!

I think I have solved this question.

In centos shell:

> mv /usr/lib64/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6_old
> cp /usr/local/lib/libsqlite3.so.0.8.6 /usr/lib64/libsqlite3.so.0.8.6

then it's ok

uwsgi has RPATH set. and its' /usr/lib64 , and the old sqlite library is in this directory, you need to use the newer sqlite library in /usr/local/lib.

you could recompile uwsgi like this: sudo LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" pip3 install uwsgi .

refrence: https://sourceexample.com/en/1c4153d4c3d4e65dac45/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM