Image upload added

Added temporary fix to loading images on the home page
Fix api.py for requesting images
Minor tweaks to default theme
This commit is contained in:
Michał Gdula 2023-01-10 18:12:55 +00:00
parent 367bb2bcc5
commit 44a6712b6e
8 changed files with 71 additions and 70 deletions

View file

@ -26,11 +26,13 @@ def create_app(test_config=None):
# Get environment variables
load_dotenv(os.path.join(app.root_path, 'user', '.env'))
# App configuration
app.config.from_mapping(
SECRET_KEY=os.environ.get('FLASK_SECRET'),
DATABASE=os.path.join(app.instance_path, 'gallery.sqlite'),
UPLOAD_FOLDER=os.path.join(app.root_path, 'user', 'uploads'),
ALLOWED_EXTENSIONS=['png', 'jpg', 'jpeg', 'webp'],
)
if test_config is None:
@ -91,14 +93,13 @@ def create_app(test_config=None):
from . import auth
app.register_blueprint(auth.blueprint)
# Load apis
from . import api
app.register_blueprint(api.blueprint)
# Load routes for home and images
from . import gallery
app.register_blueprint(gallery.blueprint)
app.add_url_rule('/', endpoint='index')
# Load APIs
from . import api
app.register_blueprint(api.blueprint)
return app