Got the database setup and am able to pull a random word from the query. I can read the themes table and have the async functions setup, but not yet working as expected. There are a few test scripts in there that need to be cleaned up before pushing to main.

This commit is contained in:
Norm Rasmussen
2023-12-04 13:32:48 -05:00
parent 275d683044
commit df49bc9b26
5 changed files with 93 additions and 48 deletions

View File

@ -1,7 +1,25 @@
from flask import Flask
from config import Config
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
app = Flask(__name__)
app.config.from_object(Config)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///words_prompts.db"
db = SQLAlchemy(app)
class AllWords(Base, db.Model):
word = db.Column(db.String, primary_key=True)
def __init__(self, word):
self.word = word
class Themes(Base, db.Model):
themes = db.Column(db.String, primary_key=True)
def __init__(self, themes):
self.themes = themes
import application.routes