简体   繁体   中英

django sqlite3 URIs not supported

Odd situation. Django 2.x in its features for sqlite3 drive turns on uri support. It seems to only be a problem seen in python 3. On machines with older version of sqlite, in my case 3.6.20, the problem of URIs not supported does not arise with exactly the same virtualenv and codebase. On machine with sqtlite3 --version showing 3.7.17 it does arise. The funny thing is the feature is only supported in sqlite3 after 3.7.7 or so from what I read. So apparently django sees it is supported but it really isn't at the level of the internal sqlite3 drivers in python? (guessing)

In [3]: sqlite3.version_info Out[3]: (2, 6, 0)

In [4]: sqlite3.sqlite_version_info Out[4]: (3, 7, 17)

On the machine it does not work on and as expected last line is (3, 6, 20) on machine it does work on.

Now I don't have full control of the machine. I thought just to pull over the lower version but no luck there. Internal libraries determine actual version even when you run sqlite3 on the command line.

I can hack the relevant part of the django driver setup but that is less than pleasing even though I do have control of the production and staging virtualenvs.

To be even more maddening I am actually not even using the ORM features of django as the project persists directly to mongo in a homebrewed but very efficient fashion. But django insists on some internal apps checking ORM db connectivity with the default being sqlite. I could I suppose put in a mysql db just for that but that also isn't very satisfying.

Is there a django setting or django clean way to deal with such I haven't thought of or a clean way to handle this if I can't reinstall sqlite3?

在我的特定情况下,我只是在django设置中设置了DATABASES = {},因为我不在项目中使用django ORM。

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