uses sqlite now
This commit is contained in:
parent
ae07e823da
commit
8e7e153989
4 changed files with 3 additions and 21 deletions
|
|
@ -1,15 +0,0 @@
|
||||||
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: mariadb:latest
|
|
||||||
container_name: lovedb
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
MARIADB_ROOT_PASSWORD: love
|
|
||||||
MARIADB_DATABASE: lovedb
|
|
||||||
MARIADB_USER: love
|
|
||||||
MARIADB_PASSWORD: love
|
|
||||||
ports:
|
|
||||||
- "3309:3306"
|
|
||||||
volumes:
|
|
||||||
- ./data:/var/lib/mysql
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
Flask
|
Flask
|
||||||
Flask-SQLAlchemy
|
Flask-SQLAlchemy
|
||||||
SQLAlchemy
|
SQLAlchemy
|
||||||
PyMySQL
|
|
||||||
python-gnupg
|
python-gnupg
|
||||||
|
|
|
||||||
BIN
src/lovedb.db
Normal file
BIN
src/lovedb.db
Normal file
Binary file not shown.
|
|
@ -13,7 +13,7 @@ os.makedirs(UPLOAD_FOLDER, exist_ok=True) # creates the uploads directorie
|
||||||
|
|
||||||
# configures the app
|
# configures the app
|
||||||
app = Flask(__name__) # creates de app
|
app = Flask(__name__) # creates de app
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://love:love@localhost:3309/lovedb' # database connection
|
app.config['SQLALCHEMY_DATABASE_URI'] = f"sqlite:///{os.path.join(BASE_DIR, 'lovedb.db')}" # database connection
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # disable track modifications (for better performance)
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # disable track modifications (for better performance)
|
||||||
app.config['SECRET_KEY'] = 'random' # sets the secret key used to generate random numbers
|
app.config['SECRET_KEY'] = 'random' # sets the secret key used to generate random numbers
|
||||||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER # sets the upload folder
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER # sets the upload folder
|
||||||
|
|
@ -154,10 +154,8 @@ def home():
|
||||||
|
|
||||||
if likes:
|
if likes:
|
||||||
likes_list = [x.strip().lower() for x in likes.split(",") if x.strip()]
|
likes_list = [x.strip().lower() for x in likes.split(",") if x.strip()]
|
||||||
for like in likes_list:
|
users = query.all()
|
||||||
query = query.filter(
|
users = [u for u in users if u.likes and all(l in u.likes for l in likes_list)]
|
||||||
text(f"JSON_CONTAINS(likes, '\"{like}\"')")
|
|
||||||
)
|
|
||||||
|
|
||||||
if dislikes:
|
if dislikes:
|
||||||
dislikes_list = [x.strip().lower() for x in dislikes.split(",") if x.strip()]
|
dislikes_list = [x.strip().lower() for x in dislikes.split(",") if x.strip()]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue