J
J
jerwright2021-03-28 23:06:58
Python
jerwright, 2021-03-28 23:06:58

How to deploy sqlite3 + python telegram bot to hosting?

Hello. I'm not experienced in this area, but the documentation did not work out. Tried to deploy a telegram bot using the sqlite3 database on Heroku, but without success. Understood that it deletes data after reboot. How can this be fixed?

Code part:

import telebot
import random
from telebot import types
import config
import sqlite3
import threading
global db
global sql
db=sqlite3.connect('gamers.db', check_same_thread=False)
sql=db.cursor()
sql.execute("""CREATE TABLE IF NOT EXISTS players (chatid TEXT, username TEXT, cash INT, inbank INT, total INT, job_blocked TEXT)""")
db.commit()

bot=telebot.TeleBot(config.TOKEN)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2021-03-29
@2ord

Don't use Sqlite on Heroku.
https://devcenter.heroku.com/articles/sqlite3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question