def reset_db(): ''' manage_db Starts up and re-initialises an SQL databse for the server ''' database_arg = "./users.db" sql_db = sql.SQLDatabase(database_arg=database_arg) sql_db.database_setup() return
import sql db = sql.SQLDatabase() db.database_setup() print(db.get_user("Abraham")) print(db.get_user("poo"))
import random from bottle import run, route, template, request, response ''' Our Model class This should control the actual "logic" of your website And nicely abstracts away the program logic from your page loading It should exist as a separate layer to any database or data structure that you might be using Nothing here should be stateful, if it's stateful let the database handle it ''' import view import sql # Initialise our views, all arguments are defaults page_view = view.View() database = sql.SQLDatabase() database.database_setup() # login = False session = {"logged_in": False} #Session information(logged in state) # ----------------------------------------------------------------------------- # Index # ----------------------------------------------------------------------------- def index_page(): return page_view("index")