python-gallery/gallery/gallery.py
Michał 2455d3f88c Fixed Flask not choosing new name for uploading
Moved uploading and removing files to APIs
Added max file upload to config from yml file
Jquery is now a file not a CDN
General Sass(y) fixes
2023-01-11 19:46:31 +00:00

52 lines
1.2 KiB
Python

from flask import Blueprint, flash, g, redirect, render_template, request, url_for, jsonify, current_app
from werkzeug.exceptions import abort
from werkzeug.utils import secure_filename
from gallery.auth import login_required
from gallery.db import get_db
from PIL import Image
import os
import datetime
dt = datetime.datetime.now()
blueprint = Blueprint('gallery', __name__)
@blueprint.route('/')
def index():
db = get_db()
images = db.execute(
'SELECT * FROM posts'
' ORDER BY created_at DESC'
).fetchall()
return render_template('index.html', images=images)
@blueprint.route('/group')
def groups():
return render_template('group.html', group_id='gwa gwa')
@blueprint.route('/group/<int:id>')
def group(id):
return render_template('group.html', group_id=id)
@blueprint.route('/upload')
@login_required
def upload():
return render_template('upload.html')
@blueprint.route('/profile')
def profile():
return render_template('profile.html', user_id='gwa gwa')
@blueprint.route('/profile/<int:id>')
def profile_id(id):
return render_template('profile.html', user_id=id)
@blueprint.route('/settings')
@login_required
def settings():
return render_template('settings.html')