CREATED RESURSE FOLDER
This commit is contained in:
BIN
__pycache__/app.cpython-312.pyc
Normal file
BIN
__pycache__/app.cpython-312.pyc
Normal file
Binary file not shown.
17
app.py
17
app.py
@@ -22,10 +22,13 @@ bcrypt = Bcrypt(app)
|
||||
|
||||
UPLOAD_FOLDER = 'static/uploads'
|
||||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||
UPLOAD_FOLDERLOGO = 'static/resurse'
|
||||
app.config['UPLOAD_FOLDERLOGO'] = UPLOAD_FOLDERLOGO
|
||||
|
||||
# Ensure the upload folder exists
|
||||
if not os.path.exists(UPLOAD_FOLDER):
|
||||
os.makedirs(UPLOAD_FOLDER)
|
||||
os.makedirs(UPLOAD_FOLDERLOGO)
|
||||
|
||||
login_manager = LoginManager(app)
|
||||
login_manager.login_view = 'login'
|
||||
@@ -84,7 +87,7 @@ def convert_ppt_to_pdf(input_file, output_file):
|
||||
def dashboard():
|
||||
players = Player.query.all()
|
||||
groups = Group.query.all()
|
||||
logo_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDER'], 'logo.png'))
|
||||
logo_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'logo.png'))
|
||||
return render_template('dashboard.html', players=players, groups=groups, logo_exists=logo_exists)
|
||||
|
||||
@app.route('/register', methods=['GET', 'POST'])
|
||||
@@ -111,7 +114,7 @@ def login():
|
||||
else:
|
||||
flash('Login Unsuccessful. Please check username and password', 'danger')
|
||||
|
||||
login_picture_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDER'], 'login_picture.png'))
|
||||
login_picture_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'login_picture.png'))
|
||||
return render_template('login.html', login_picture_exists=login_picture_exists)
|
||||
|
||||
@app.route('/logout')
|
||||
@@ -180,8 +183,8 @@ def upload_content():
|
||||
@login_required
|
||||
@admin_required
|
||||
def admin():
|
||||
logo_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDER'], 'logo.png'))
|
||||
login_picture_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDER'], 'login_picture.png'))
|
||||
logo_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'logo.png'))
|
||||
login_picture_exists = os.path.exists(os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'login_picture.png'))
|
||||
users = User.query.all()
|
||||
return render_template('admin.html', users=users, logo_exists=logo_exists, login_picture_exists=login_picture_exists)
|
||||
|
||||
@@ -449,7 +452,7 @@ def upload_logo():
|
||||
|
||||
if file:
|
||||
filename = secure_filename(file.filename)
|
||||
file_path = os.path.join(app.config['UPLOAD_FOLDER'], 'logo.png')
|
||||
file_path = os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'logo.png')
|
||||
file.save(file_path)
|
||||
return redirect(url_for('admin'))
|
||||
|
||||
@@ -462,12 +465,12 @@ def upload_personalization_pictures():
|
||||
|
||||
if logo_file and logo_file.filename != '':
|
||||
logo_filename = secure_filename(logo_file.filename)
|
||||
logo_file_path = os.path.join(app.config['UPLOAD_FOLDER'], 'logo.png')
|
||||
logo_file_path = os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'logo.png')
|
||||
logo_file.save(logo_file_path)
|
||||
|
||||
if login_picture_file and login_picture_file.filename != '':
|
||||
login_picture_filename = secure_filename(login_picture_file.filename)
|
||||
login_picture_file_path = os.path.join(app.config['UPLOAD_FOLDER'], 'login_picture.png')
|
||||
login_picture_file_path = os.path.join(app.config['UPLOAD_FOLDERLOGO'], 'login_picture.png')
|
||||
login_picture_file.save(login_picture_file_path)
|
||||
|
||||
return redirect(url_for('admin'))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
python -m venv digiscreen
|
||||
python3 -m venv digiscreen
|
||||
|
||||
source digiscreen/bin/activate
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
@@ -41,7 +41,7 @@
|
||||
<div class="container py-5">
|
||||
<div class="d-flex justify-content-start align-items-center mb-4">
|
||||
{% if logo_exists %}
|
||||
<img src="{{ url_for('static', filename='uploads/logo.png') }}" alt="Logo" class="logo">
|
||||
<img src="{{ url_for('static', filename='resurse/logo.png') }}" alt="Logo" class="logo">
|
||||
{% endif %}
|
||||
<h1 class="mb-0">Admin Panel</h1>
|
||||
</div>
|
||||
@@ -122,7 +122,7 @@
|
||||
<div class="col-md-4">
|
||||
<label for="logo" class="form-label">Current Logo</label>
|
||||
{% if logo_exists %}
|
||||
<img src="{{ url_for('static', filename='uploads/logo.png') }}" alt="Current Logo" class="img-thumbnail img-preview mb-3">
|
||||
<img src="{{ url_for('static', filename='resurse/logo.png') }}" alt="Current Logo" class="img-thumbnail img-preview mb-3">
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
@@ -134,7 +134,7 @@
|
||||
<div class="col-md-4">
|
||||
<label for="login_picture" class="form-label">Current Login Page Picture</label>
|
||||
{% if login_picture_exists %}
|
||||
<img src="{{ url_for('static', filename='uploads/login_picture.png') }}" alt="Current Login Picture" class="img-thumbnail img-preview mb-3">
|
||||
<img src="{{ url_for('static', filename='resurse/login_picture.png') }}" alt="Current Login Picture" class="img-thumbnail img-preview mb-3">
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
Reference in New Issue
Block a user