updated to folders

This commit is contained in:
Ske087
2025-02-01 22:38:22 +02:00
parent 2b259af3a5
commit 6b9c3e6847
5 changed files with 19 additions and 5 deletions

Binary file not shown.

18
app.py
View File

@@ -9,14 +9,18 @@ from flask_migrate import Migrate
from pdf2image import convert_from_path from pdf2image import convert_from_path
import subprocess import subprocess
app = Flask(__name__) app = Flask(__name__, instance_relative_config=True)
# Set the secret key from environment variable or use a default value # Set the secret key from environment variable or use a default value
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'Ana_Are_Multe_Mere-Si_Nu_Are_Pere') app.config['SECRET_KEY'] = os.getenv('SECRET_KEY', 'Ana_Are_Multe_Mere-Si_Nu_Are_Pere')
# Configurare baza de date SQLite # Configure the database location to be in the instance folder
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///dashboard.db' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(app.instance_path, 'dashboard.db')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# Ensure the instance folder exists
os.makedirs(app.instance_path, exist_ok=True)
db = SQLAlchemy(app) db = SQLAlchemy(app)
bcrypt = Bcrypt(app) bcrypt = Bcrypt(app)
@@ -376,8 +380,16 @@ def group_fullscreen(group_id):
@admin_required @admin_required
def delete_player(player_id): def delete_player(player_id):
player = Player.query.get_or_404(player_id) player = Player.query.get_or_404(player_id)
# Delete all media related to the player
media_items = Content.query.filter_by(player_id=player_id).all()
for media in media_items:
db.session.delete(media)
# Delete the player
db.session.delete(player) db.session.delete(player)
db.session.commit() db.session.commit()
return redirect(url_for('dashboard')) return redirect(url_for('dashboard'))
@app.route('/player/add', methods=['GET', 'POST']) @app.route('/player/add', methods=['GET', 'POST'])

Binary file not shown.

View File

@@ -1,8 +1,8 @@
version: '3.8'
services: services:
web: web:
image: digi_server:latest image: digi-server:latest
ports: ports:
- "7100:5000" - "7100:5000"
environment: environment:
@@ -13,4 +13,6 @@ services:
- SECRET_KEY=Ma_Duc_Dupa_Merele_Lui_Ana - SECRET_KEY=Ma_Duc_Dupa_Merele_Lui_Ana
volumes: volumes:
- .:/app - .:/app
- ./data/db:/app/instance
- ./data/static:/app/static/uploads
command: sh -c "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app" command: sh -c "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"

Binary file not shown.