updated to folders
This commit is contained in:
Binary file not shown.
18
app.py
18
app.py
@@ -9,14 +9,18 @@ from flask_migrate import Migrate
|
||||
from pdf2image import convert_from_path
|
||||
import subprocess
|
||||
|
||||
app = Flask(__name__)
|
||||
app = Flask(__name__, instance_relative_config=True)
|
||||
|
||||
# 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')
|
||||
|
||||
# Configurare baza de date SQLite
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///dashboard.db'
|
||||
# Configure the database location to be in the instance folder
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(app.instance_path, 'dashboard.db')
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
# Ensure the instance folder exists
|
||||
os.makedirs(app.instance_path, exist_ok=True)
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
bcrypt = Bcrypt(app)
|
||||
|
||||
@@ -376,8 +380,16 @@ def group_fullscreen(group_id):
|
||||
@admin_required
|
||||
def delete_player(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.commit()
|
||||
|
||||
return redirect(url_for('dashboard'))
|
||||
|
||||
@app.route('/player/add', methods=['GET', 'POST'])
|
||||
|
||||
BIN
dashboard.db
BIN
dashboard.db
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
web:
|
||||
image: digi_server:latest
|
||||
image: digi-server:latest
|
||||
ports:
|
||||
- "7100:5000"
|
||||
environment:
|
||||
@@ -13,4 +13,6 @@ services:
|
||||
- SECRET_KEY=Ma_Duc_Dupa_Merele_Lui_Ana
|
||||
volumes:
|
||||
- .:/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"
|
||||
Binary file not shown.
Reference in New Issue
Block a user