forked from Ugric/Komodo-Hub
changed 'species.db' to 'database.db', removed defunct python file, updated .gitignore
This commit is contained in:
1 parent
409725920f
commit
e28a269abf
4 files changed
+2
-49
No files matched your search
@@ -218,3 +218,4 @@ database/species.db
|
||||
static/images/.DS_Store
|
||||
.DS_Store
|
||||
|
||||
database/database.db
|
||||
@@ -1,7 +1,7 @@
|
||||
import sqlite3
|
||||
from contextlib import contextmanager
|
||||
|
||||
DATABASE_PATH = "database/species.db"
|
||||
DATABASE_PATH = "database/database.db"
|
||||
|
||||
@contextmanager
|
||||
def get_db():
|
||||
|
||||
@@ -2,8 +2,6 @@ from flask import render_template, Blueprint
|
||||
import configparser
|
||||
from utilities.featured_species import featured_species_function
|
||||
|
||||
# config = configparser.ConfigParser()
|
||||
|
||||
page = Blueprint("home", __name__, url_prefix="/")
|
||||
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import sqlite3
|
||||
from datetime import datetime
|
||||
# from main import database as db
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def add_species(english, latin, body):
|
||||
db = sqlite3.connect("database/species.db", check_same_thread=False)
|
||||
db.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS species (
|
||||
species_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
species_english TEXT,
|
||||
species_latin TEXT,
|
||||
body_text TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
"""
|
||||
)
|
||||
db.commit()
|
||||
print("Database initialized.")
|
||||
|
||||
cursor = db.cursor()
|
||||
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO species (
|
||||
species_english,
|
||||
species_latin,
|
||||
body_text,
|
||||
created_at
|
||||
)
|
||||
VALUES (?, ?, ?, ?)
|
||||
""",
|
||||
(english, latin, body, datetime.now()),
|
||||
)
|
||||
|
||||
db.commit()
|
||||
db.close()
|
||||
|
||||
print("Species added successfully.")
|
||||
|
||||
|
||||
Reference in new issue
Block a user