I've been trying to run this example in the contact of a cPane/Passenger Python app and seem to be having trouble creating the initial table - a quick test reports the following:
(sqlite3.OperationalError) no such table: users [SQL: 'INSERT INTO users (social_id, nickname, email) VALUES (?, ?, ?)'] [parameters: ('test1', 'ntest1', 'emtest1')]
@app.route('/test')
def test():
user = User(social_id='test1', nickname='ntest1', email='emtest1')
db.session.add(user)
#Failing on the commit:
#(sqlite3.OperationalError) no such table: users [SQL: 'INSERT INTO users (social_id, nickname, email) VALUES (?, ?, ?)'] [parameters: ('test1', 'ntest1', 'emtest1')]
try:
db.session.commit()
except BaseException as e:
return str(e)
Looking at the size of the sqlite file, and also trying to initialises the database directly via a Python terminal, it seems that even though the SQLite file is created it is always empty (0 bytes).