-
-
-
+
-
-
-
Profile
-Hello {{ g.user['username'] }}
+{{ user.username }}
+Member since {{ user.joined_at }}
User
-{{user_id}}
+ {% if images %} +
+ {% for image in images %}
+
+
+ {% else %}
+
+
+
+
+
+ {% endfor %}
+ {{ image.created_at }}
+
+
+ {% endif %}
{% endblock %}
diff --git a/gallery/templates/settings/account.html b/gallery/templates/settings/account.html
index c6f0dc4..e3360ad 100644
--- a/gallery/templates/settings/account.html
+++ b/gallery/templates/settings/account.html
@@ -3,5 +3,10 @@
{% block settings_account %}settings-nav__item-selected{% endblock %}
{% block settings_content %}
*crickets chirping*
+There are no images here yet, upload some!
+Account
- Logout +Is session fresh?
+ {% if fresh %} +Yes
+ {% else %} +No
+ {% endif %} {% endblock %} \ No newline at end of file diff --git a/gallery/templates/settings/settings_layout.html b/gallery/templates/settings/settings_layout.html index ccf3aec..a51f7d3 100644 --- a/gallery/templates/settings/settings_layout.html +++ b/gallery/templates/settings/settings_layout.html @@ -2,14 +2,17 @@ {% block nav_settings %}selected{% endblock %} {% block content %} -
-
-
-
+
diff --git a/gallery/themes/default/components/banner.sass b/gallery/themes/default/components/banner.sass
deleted file mode 100644
index 97aa3a7..0000000
--- a/gallery/themes/default/components/banner.sass
+++ /dev/null
@@ -1,119 +0,0 @@
-.banner
- width: 100%
- height: 50vh
-
- position: relative
-
- background-color: RGB($bg-300)
- color: RGB($fg-white)
-
- overflow: hidden
- transition: opacity 0.3s ease-in-out
-
- img
- position: absolute
- top: 0
- left: 0
-
- width: 100%
- height: 100%
-
- background-color: RGB($bg-300)
-
- object-fit: cover
- object-position: center center
-
- .banner-filter
- position: absolute
- top: 0
- left: 0
-
- width: 100%
- height: 100%
-
- background: linear-gradient(to right, RGB($primary), transparent)
-
- z-index: +1
-
- .banner-content
- padding: 1rem
-
- width: 100%
- height: inherit
-
- position: relative
-
- display: flex
- flex-direction: column
- justify-content: flex-end
-
- z-index: +2
-
- h1
- margin: 0
- padding: 0
-
- font-size: 6.9rem
- font-weight: 800
- text-align: left
-
- color: RGB($primary)
-
- p
- margin: 0
- padding: 0
-
- font-size: 1rem
- font-weight: 600
- line-height: 1
- text-align: left
-
- &.small
- height: 3.5rem
- background-color: RGB($bg-100)
-
- .banner-content
- padding: 0.5rem
-
- flex-direction: row
- justify-content: flex-start
- align-items: center
- gap: 1rem
-
- h1
- padding-bottom: 0.25rem
- font-size: 1.5rem
- text-align: left
-
- p
- font-size: 0.9rem
- text-align: left
-
-@media (max-width: $breakpoint)
- .banner
- width: 100vw
- height: 25vh
-
- .banner-content
- padding: 0.5rem
-
- display: flex
- justify-content: center
- align-items: center
-
- h1
- font-size: 3rem
- text-align: center
-
- p
- font-size: 1.1rem
- text-align: center
-
- &.small .banner-content
- justify-content: center
-
- h1
- text-align: center
-
- p
- display: none
\ No newline at end of file
diff --git a/gallery/themes/default/components/elements/labels.sass b/gallery/themes/default/components/elements/labels.sass
deleted file mode 100644
index fb816ba..0000000
--- a/gallery/themes/default/components/elements/labels.sass
+++ /dev/null
@@ -1,33 +0,0 @@
-.label
- padding: 0.4rem 0.7rem
-
- display: block
- position: absolute
-
- font-size: 0.9rem
- font-weight: 600
-
- background-color: RGB($bg-dim)
- color: RGB($fg-white)
- border-radius: $rad-inner
- opacity: 0
-
- transition: opacity 0.2s cubic-bezier(.76,0,.17,1), left 0.2s cubic-bezier(.76,0,.17,1)
- pointer-events: none
- z-index: 999
-
- svg
- margin: 0
- font-size: 1rem
-
- width: 0.75rem
- height: 0.75rem
-
- display: block
-
- position: absolute
- top: 50%
- left: -0.45rem
- transform: translateY(-50%)
-
- color: RGB($bg-dim)
diff --git a/gallery/themes/default/fonts/worksans-black.woff2 b/gallery/themes/default/fonts/worksans-black.woff2
deleted file mode 100644
index ab8516a..0000000
Binary files a/gallery/themes/default/fonts/worksans-black.woff2 and /dev/null differ
diff --git a/gallery/themes/default/fonts/worksans-bold.woff2 b/gallery/themes/default/fonts/worksans-bold.woff2
deleted file mode 100644
index b3d3831..0000000
Binary files a/gallery/themes/default/fonts/worksans-bold.woff2 and /dev/null differ
diff --git a/gallery/themes/default/fonts/worksans-regular.woff2 b/gallery/themes/default/fonts/worksans-regular.woff2
deleted file mode 100644
index e9fcd6e..0000000
Binary files a/gallery/themes/default/fonts/worksans-regular.woff2 and /dev/null differ
diff --git a/gallery/utils/contrast.py b/gallery/utils/contrast.py
index 27b5d9b..fb3115c 100644
--- a/gallery/utils/contrast.py
+++ b/gallery/utils/contrast.py
@@ -3,7 +3,7 @@ Calculate the contrast between two colors
"""
-def contrast(background, light, dark, threshold = 0.179):
+def contrast(background, light, dark, threshold=0.179):
"""
background: tuple of (r, g, b) values
light: color to use if the background is light
diff --git a/gallery/utils/generate_image.py b/gallery/utils/generate_image.py
index 00a1083..e14acfb 100644
--- a/gallery/utils/generate_image.py
+++ b/gallery/utils/generate_image.py
@@ -4,7 +4,7 @@ Tools for generating images and thumbnails
import os
import platformdirs
-from PIL import Image, ImageOps #, ImageFilter
+from PIL import Image, ImageOps
from werkzeug.utils import secure_filename
@@ -37,11 +37,9 @@ def generate_thumbnail(file_name, resolution, ext=None):
if resolution in ['prev', 'preview']:
res_x, res_y = (1920, 1080)
elif resolution in ['thumb', 'thumbnail']:
- res_x, res_y = (400, 400)
+ res_x, res_y = (350, 350)
elif resolution in ['icon', 'favicon']:
res_x, res_y = (10, 10)
- elif len(resolution.split('x')) == 2:
- res_x, res_y = resolution.split('x')
else:
return None
@@ -65,13 +63,13 @@ def generate_thumbnail(file_name, resolution, ext=None):
# Save image to cache directory
try:
image.save(os.path.join(CACHE_PATH, f'{file_name}_{res_x}x{res_y}.{ext}'),
- icc_profile=image_icc)
+ icc_profile=image_icc)
except OSError:
# This usually happens when saving a JPEG with an ICC profile,
# so we convert to RGB and try again
image = image.convert('RGB')
image.save(os.path.join(CACHE_PATH, f'{file_name}_{res_x}x{res_y}.{ext}'),
- icc_profile=image_icc)
+ icc_profile=image_icc)
# No need to keep the image in memory, learned the hard way
image.close()
diff --git a/gallery/utils/metadata/helpers.py b/gallery/utils/metadata/helpers.py
index bbac087..e7b8cd3 100644
--- a/gallery/utils/metadata/helpers.py
+++ b/gallery/utils/metadata/helpers.py
@@ -279,7 +279,7 @@ def lens_specification(value):
"""
try:
return str(value[0] / value[1]) + 'mm - ' + str(value[2] / value[3]) + 'mm'
- except ValueError:
+ except TypeError:
return None
diff --git a/gallery/utils/theme_manager.py b/gallery/utils/theme_manager.py
deleted file mode 100644
index c6e8f5f..0000000
--- a/gallery/utils/theme_manager.py
+++ /dev/null
@@ -1,55 +0,0 @@
-"""
-OnlyLegs - Theme Manager
-"""
-import os
-import sys
-import shutil
-from datetime import datetime
-import sass
-
-
-def compile_theme(theme_name, app_path):
- """
- Compiles the theme into the static folder
- """
- print(f"Loading '{theme_name}' theme...")
-
- # Set Paths
- theme_source = os.path.join(app_path, 'themes', theme_name)
- theme_destination = os.path.join(app_path, 'static', 'theme')
-
- # If the theme doesn't exist, exit
- if not os.path.exists(theme_source):
- print("Theme does not exist!")
- sys.exit(1)
-
- # If the destination folder doesn't exist, create it
- if not os.path.exists(theme_destination):
- os.makedirs(theme_destination)
-
- # Theme source file doesn't exist, exit
- if not os.path.join(theme_source, 'style.sass'):
- print("No sass file found!")
- sys.exit(1)
-
- # Compile the theme
- with open(os.path.join(theme_destination, 'style.css'),
- encoding='utf-8', mode='w+') as file:
- try:
- file.write(sass.compile(filename=os.path.join(theme_source, 'style.sass'),
- output_style='compressed'))
- except sass.CompileError as err:
- print("Failed to compile!\n", err)
- sys.exit(1)
- print("Compiled successfully!")
-
- # If the destination folder exists, remove it
- if os.path.exists(os.path.join(theme_destination, 'fonts')):
- shutil.rmtree(os.path.join(theme_destination, 'fonts'))
-
- # Copy the fonts
- shutil.copytree(os.path.join(theme_source, 'fonts'),
- os.path.join(theme_destination, 'fonts'))
- print("Fonts copied successfully!")
-
- print(f"{datetime.now().hour}:{datetime.now().minute}:{datetime.now().second} - Done!\n")
diff --git a/gallery/views/__init__.py b/gallery/views/__init__.py
new file mode 100644
index 0000000..c357e84
--- /dev/null
+++ b/gallery/views/__init__.py
@@ -0,0 +1 @@
+# :3
diff --git a/gallery/routes/api.py b/gallery/views/api.py
similarity index 78%
rename from gallery/routes/api.py
rename to gallery/views/api.py
index a7c9303..7e386dc 100644
--- a/gallery/routes/api.py
+++ b/gallery/views/api.py
@@ -5,16 +5,16 @@ from uuid import uuid4
import os
import pathlib
import logging
-from datetime import datetime as dt
import platformdirs
-from flask import Blueprint, send_from_directory, abort, flash, jsonify, request, g, current_app
+from flask import Blueprint, send_from_directory, abort, flash, request, current_app
from werkzeug.utils import secure_filename
+from flask_login import login_required, current_user
+
from colorthief import ColorThief
from sqlalchemy.orm import sessionmaker
-from gallery.auth import login_required
from gallery import db
from gallery.utils import metadata as mt
@@ -37,7 +37,7 @@ def file(file_name):
file_name = secure_filename(file_name) # Sanitize file name
# if no args are passed, return the raw file
- if not request.args:
+ if not res and not ext:
if not os.path.exists(os.path.join(current_app.config['UPLOAD_FOLDER'], file_name)):
abort(404)
return send_from_directory(current_app.config['UPLOAD_FOLDER'], file_name)
@@ -64,7 +64,7 @@ def upload():
# Get file extension, generate random name and set file path
img_ext = pathlib.Path(form_file.filename).suffix.replace('.', '').lower()
- img_name = "GWAGWA_"+str(uuid4())
+ img_name = "GWAGWA_" + str(uuid4())
img_path = os.path.join(current_app.config['UPLOAD_FOLDER'], img_name+'.'+img_ext)
# Check if file extension is allowed
@@ -83,14 +83,13 @@ def upload():
img_colors = ColorThief(img_path).get_palette(color_count=3) # Get color palette
# Save to database
- query = db.Posts(author_id=g.user.id,
- created_at=dt.utcnow(),
- file_name=img_name+'.'+img_ext,
- file_type=img_ext,
- image_exif=img_exif,
- image_colours=img_colors,
- post_description=form['description'],
- post_alt=form['alt'])
+ query = db.Posts(author_id=current_user.id,
+ filename=img_name + '.' + img_ext,
+ mimetype=img_ext,
+ exif=img_exif,
+ colours=img_colors,
+ description=form['description'],
+ alt=form['alt'])
db_session.add(query)
db_session.commit()
@@ -109,18 +108,18 @@ def delete_image(image_id):
# Check if image exists and if user is allowed to delete it (author)
if img is None:
abort(404)
- if img.author_id != g.user.id:
+ if img.author_id != current_user.id:
abort(403)
# Delete file
try:
- os.remove(os.path.join(current_app.config['UPLOAD_FOLDER'],img.file_name))
+ os.remove(os.path.join(current_app.config['UPLOAD_FOLDER'], img.filename))
except FileNotFoundError:
- logging.warning('File not found: %s, already deleted or never existed', img.file_name)
+ logging.warning('File not found: %s, already deleted or never existed', img.filename)
# Delete cached files
cache_path = os.path.join(platformdirs.user_config_dir('onlylegs'), 'cache')
- cache_name = img.file_name.rsplit('.')[0]
+ cache_name = img.filename.rsplit('.')[0]
for cache_file in pathlib.Path(cache_path).glob(cache_name + '*'):
os.remove(cache_file)
@@ -135,7 +134,7 @@ def delete_image(image_id):
# Commit all changes
db_session.commit()
- logging.info('Removed image (%s) %s', image_id, img.file_name)
+ logging.info('Removed image (%s) %s', image_id, img.filename)
flash(['Image was all in Le Head!', '1'])
return 'Gwa Gwa'
@@ -148,8 +147,7 @@ def create_group():
"""
new_group = db.Groups(name=request.form['name'],
description=request.form['description'],
- author_id=g.user.id,
- created_at=dt.utcnow())
+ author_id=current_user.id)
db_session.add(new_group)
db_session.commit()
@@ -165,21 +163,21 @@ def modify_group():
"""
group_id = request.form['group']
image_id = request.form['image']
+ action = request.form['action']
group = db_session.query(db.Groups).filter_by(id=group_id).first()
if group is None:
abort(404)
- elif group.author_id != g.user.id:
+ elif group.author_id != current_user.id:
abort(403)
- if request.form['action'] == 'add':
+ if action == 'add':
if not (db_session.query(db.GroupJunction)
.filter_by(group_id=group_id, post_id=image_id)
.first()):
db_session.add(db.GroupJunction(group_id=group_id,
- post_id=image_id,
- date_added=dt.utcnow()))
+ post_id=image_id))
elif request.form['action'] == 'remove':
(db_session.query(db.GroupJunction)
.filter_by(group_id=group_id, post_id=image_id)
@@ -190,17 +188,23 @@ def modify_group():
return ':3'
-@blueprint.route('/metadata/', methods=['GET'])
-def metadata(img_id):
+@blueprint.route('/group/delete', methods=['POST'])
+def delete_group():
"""
- Yoinks metadata from an image
+ Deletes a group
"""
- img = db_session.query(db.Posts).filter_by(id=img_id).first()
+ group_id = request.form['group']
- if not img:
+ group = db_session.query(db.Groups).filter_by(id=group_id).first()
+
+ if group is None:
abort(404)
+ elif group.author_id != current_user.id:
+ abort(403)
- img_path = os.path.join(current_app.config['UPLOAD_FOLDER'], img.file_name)
- exif = mt.Metadata(img_path).yoink()
+ db_session.query(db.Groups).filter_by(id=group_id).delete()
+ db_session.query(db.GroupJunction).filter_by(group_id=group_id).delete()
+ db_session.commit()
- return jsonify(exif)
+ flash(['Group yeeted!', '1'])
+ return ':3'
diff --git a/gallery/routes/groups.py b/gallery/views/groups.py
similarity index 95%
rename from gallery/routes/groups.py
rename to gallery/views/groups.py
index 48def48..ac9cd5e 100644
--- a/gallery/routes/groups.py
+++ b/gallery/views/groups.py
@@ -37,8 +37,8 @@ def groups():
# For each image, get the image data and add it to the group item
group.images = []
for image in images:
- group.images.append(db_session.query(db.Posts.file_name, db.Posts.post_alt,
- db.Posts.image_colours, db.Posts.id)
+ group.images.append(db_session.query(db.Posts.filename, db.Posts.alt,
+ db.Posts.colours, db.Posts.id)
.filter(db.Posts.id == image[0])
.first())
@@ -78,8 +78,8 @@ def group(group_id):
# Check contrast for the first image in the group for the banner
text_colour = 'rgb(var(--fg-black))'
- if images[0]:
- text_colour = contrast.contrast(images[0].image_colours[0],
+ if images:
+ text_colour = contrast.contrast(images[0].colours[0],
'rgb(var(--fg-black))',
'rgb(var(--fg-white))')
diff --git a/gallery/routes/routing.py b/gallery/views/routing.py
similarity index 75%
rename from gallery/routes/routing.py
rename to gallery/views/routing.py
index e40a8ef..a398e54 100644
--- a/gallery/routes/routing.py
+++ b/gallery/views/routing.py
@@ -3,6 +3,7 @@ Onlylegs Gallery - Routing
"""
from flask import Blueprint, render_template, url_for, request
from werkzeug.exceptions import abort
+from flask_login import current_user
from sqlalchemy.orm import sessionmaker
from gallery import db
@@ -18,9 +19,9 @@ def index():
"""
Home page of the website, shows the feed of the latest images
"""
- images = db_session.query(db.Posts.file_name,
- db.Posts.post_alt,
- db.Posts.image_colours,
+ images = db_session.query(db.Posts.filename,
+ db.Posts.alt,
+ db.Posts.colours,
db.Posts.created_at,
db.Posts.id).order_by(db.Posts.id.desc()).all()
@@ -81,12 +82,21 @@ def profile():
"""
Profile overview, shows all profiles on the onlylegs gallery
"""
- return render_template('profile.html', user_id='gwa gwa')
+ user_id = request.args.get('id', default=None, type=int)
+ # If there is no userID set, check if the user is logged in and display their profile
+ if not user_id:
+ if current_user.is_authenticated:
+ user_id = current_user.id
+ else:
+ abort(404, 'You must be logged in to view your own profile!')
-@blueprint.route('/profile/')
-def profile_id(user_id):
- """
- Shows user ofa given id, displays their uploads and other info
- """
- return render_template('profile.html', user_id=user_id)
+ # Get the user's data
+ user = db_session.query(db.Users).filter(db.Users.id == user_id).first()
+
+ if not user:
+ abort(404, 'User not found :c')
+
+ images = db_session.query(db.Posts).filter(db.Posts.author_id == user_id).all()
+
+ return render_template('profile.html', user=user, images=images)
diff --git a/gallery/routes/settings.py b/gallery/views/settings.py
similarity index 94%
rename from gallery/routes/settings.py
rename to gallery/views/settings.py
index 04da5e4..94926e9 100644
--- a/gallery/routes/settings.py
+++ b/gallery/views/settings.py
@@ -2,9 +2,7 @@
OnlyLegs - Settings page
"""
from flask import Blueprint, render_template
-
-from gallery.auth import login_required
-
+from flask_login import login_required
blueprint = Blueprint('settings', __name__, url_prefix='/settings')
diff --git a/poetry.lock b/poetry.lock
index 8fc8537..26dbdbd 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand.
[[package]]
name = "astroid"
@@ -253,21 +253,20 @@ brotli = "*"
flask = "*"
[[package]]
-name = "flask-session2"
-version = "1.3.1"
-description = "Adds server-side session support to your Flask application"
+name = "flask-login"
+version = "0.6.2"
+description = "User authentication and session management for Flask."
category = "main"
optional = false
-python-versions = ">=3.7.2,<4.0.0"
+python-versions = ">=3.7"
files = [
- {file = "Flask-Session2-1.3.1.tar.gz", hash = "sha256:171e986d4e314795f448a527095e42df6abfba76c3e4ce5c8e4c61c857c59cb2"},
- {file = "Flask_Session2-1.3.1-py3-none-any.whl", hash = "sha256:6d1615dfc4b247759f31f89bf16aba96fa1294077e700771875abe952f291959"},
+ {file = "Flask-Login-0.6.2.tar.gz", hash = "sha256:c0a7baa9fdc448cdd3dd6f0939df72eec5177b2f7abe6cb82fc934d29caac9c3"},
+ {file = "Flask_Login-0.6.2-py3-none-any.whl", hash = "sha256:1ef79843f5eddd0f143c2cd994c1b05ac83c0401dc6234c143495af9a939613f"},
]
[package.dependencies]
-cachelib = ">=0.9.0,<0.10.0"
-Flask = ">=2.2.2,<3.0.0"
-pytz = ">=2022.2.1,<2023.0.0"
+Flask = ">=1.0.4"
+Werkzeug = ">=1.0.1"
[[package]]
name = "greenlet"
@@ -706,18 +705,6 @@ files = [
[package.extras]
cli = ["click (>=5.0)"]
-[[package]]
-name = "pytz"
-version = "2022.7.1"
-description = "World timezone definitions, modern and historical"
-category = "main"
-optional = false
-python-versions = "*"
-files = [
- {file = "pytz-2022.7.1-py2.py3-none-any.whl", hash = "sha256:78f4f37d8198e0627c5f1143240bb0206b8691d8d7ac6d78fee88b78733f8c4a"},
- {file = "pytz-2022.7.1.tar.gz", hash = "sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0"},
-]
-
[[package]]
name = "pyyaml"
version = "6.0"
@@ -1033,4 +1020,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
-content-hash = "fdc83d433d98ba079b4614e37da26b9c81f07e0a646606c17de5c0fb07ae483e"
+content-hash = "431b58579dc3ebde52c8f3905c851556a465d5a82796a8a26718d69cb4915959"
diff --git a/pyproject.toml b/pyproject.toml
index 6055e83..4620353 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "onlylegs"
-version = "23.03.30"
+version = "23.04.05"
description = "Gallery built for fast and simple image management"
authors = ["Fluffy-Bean "]
license = "MIT"
@@ -12,7 +12,7 @@ Flask = "^2.2.2"
Flask-Compress = "^1.13"
Flask-Caching = "^2.0.2"
Flask-Assets = "^2.0"
-Flask-Session2 = "^1.3.1"
+Flask-Login = "^0.6.2"
SQLAlchemy = "^2.0.3"
python-dotenv = "^0.21.0"
gunicorn = "^20.1.0"
diff --git a/run.py b/run.py
index c9c6303..89de085 100644
--- a/run.py
+++ b/run.py
@@ -14,7 +14,7 @@ print("""
#+# #+# #+# #+#+# #+# #+# #+# #+# #+# #+# #+# #+#
######## ### #### ########## ### ########## ######### ######### ########
- Created by Fluffy Bean - Version 23.03.30
+ Created by Fluffy Bean - Version 23.04.05
""")
@@ -24,18 +24,13 @@ Configuration()
if DEBUG:
from gallery import create_app
-
- # If no address is specified, use localhost
- if not ADDRESS:
- ADDRESS = 'localhost'
-
create_app().run(host=ADDRESS, port=PORT, debug=True, threaded=True)
else:
from setup.runner import OnlyLegs # pylint: disable=C0412
+ import sys
- # If no address is specified, bind the server to all interfaces
- if not ADDRESS:
- ADDRESS = '0.0.0.0'
+ # Stop Gunicorn from reading the command line arguments as it causes errors
+ sys.argv = [sys.argv[0]]
options = {
'bind': f'{ADDRESS}:{PORT}',
diff --git a/setup/args.py b/setup/args.py
index af2f6dc..bfc299f 100644
--- a/setup/args.py
+++ b/setup/args.py
@@ -2,7 +2,7 @@
Startup arguments for the OnlyLegs gallery
-p, --port: Port to run on (default: 5000)
- -a, --address: Address to run on (default: For Debug: localhost, For Production: 0.0.0.0)
+ -a, --address: Address to run on (default: 127.0.0.0)
-w, --workers: Number of workers to run (default: 4)
-d, --debug: Run as Flask app in debug mode (default: False)
@@ -15,7 +15,7 @@ import argparse
parser = argparse.ArgumentParser(description='Run the OnlyLegs gallery')
parser.add_argument('-p', '--port', type=int, default=5000, help='Port to run on')
-parser.add_argument('-a', '--address', type=str, default=None, help='Address to run on')
+parser.add_argument('-a', '--address', type=str, default='127.0.0.0', help='Address to run on')
parser.add_argument('-w', '--workers', type=int, default=4, help='Number of workers to run')
parser.add_argument('-d', '--debug', action='store_true', help='Run as Flask app in debug mode')
args = parser.parse_args()
diff --git a/setup/configuration.py b/setup/configuration.py
index 6f7cf74..8968379 100644
--- a/setup/configuration.py
+++ b/setup/configuration.py
@@ -135,15 +135,9 @@ class Configuration:
"""
Set the logging config
"""
- logs_path = os.path.join(platformdirs.user_config_dir('onlylegs'), 'logs')
-
- if not os.path.isdir(logs_path):
- os.mkdir(logs_path)
- print("Created logs directory at:", logs_path)
-
logging.getLogger('werkzeug').disabled = True
logging.basicConfig(
- filename=os.path.join(logs_path, 'only.log'),
+ filename=os.path.join(USER_DIR, 'only.log'),
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S',
format='%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s',
diff --git a/setup/runner.py b/setup/runner.py
index 45271ca..20496d2 100644
--- a/setup/runner.py
+++ b/setup/runner.py
@@ -9,7 +9,7 @@ class OnlyLegs(Application):
"""
Gunicorn application
"""
- def __init__(self, options={}): # pylint: disable=W0102, W0231 # noqa
+ def __init__(self, options={}): # pylint: disable=W0102, W0231
self.usage = None
self.callable = None
self.options = options
@@ -25,7 +25,8 @@ class OnlyLegs(Application):
cfg[setting.lower()] = value
return cfg
- def prog(self): # pylint: disable=C0116, E0202 # noqa
+ @staticmethod
+ def prog(): # pylint: disable=C0116, E0202
return 'OnlyLegs'
def load(self):
- {% block banner_subtitle%}{% endblock %}
-
Settings
-All the red buttons in one place, what could go wrong?
+Settings
+{% block banner_subtitle%}{% endblock %}
+
+
+
+
+
+
+