I have a website that loads/displays by grabbing the HTML from an SQLite3 database & displaying that (so if the user is on a Smart phone it will grab different HTML from the database than for someone on IE). I use python scripts as the server side behaviour to interact with the SQLite3 database & post the HTML.
My problem is: I am hosting the website with BlueHost & they only allow python 2.4 to run & the python SQLite3 module is a feature of Python 2.6 (or 2.7) & up. So my python scripts dont work when they run on BlueHost.
What do you think I can do to get my website to still use SQLite3 on the website? Are there any options for me? Maybe I can upload the Python module my fodler where my python scripts are?
1 Answer 1
The sqlite3 module in python 2.5+ is based on the pysqlite package, which does work for python 2.4. You can instead install that package and swap the import, then you can use it with less work.
One option to support both methods is to use a conditional import, like this:
try:
import sqlite3
except ImportError:
from pysqlite import dbapi2 as sqlite3