-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from tkzt/feature/manager
A basic image manager
- Loading branch information
Showing
37 changed files
with
1,733 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,4 @@ jobs: | |
- name: Lint | ||
run: pnpm run lint | ||
- name: Build | ||
run: pnpm run build | ||
run: pnpm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.DS_Store | ||
manager_data/ | ||
.idea |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
}, | ||
"javascript.format.semicolons": "remove", | ||
"html.format.wrapLineLength": 98, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
|
||
</html> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,4 @@ http { | |
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,4 @@ | |
"unocss": "^0.53.0", | ||
"vite": "^4.0.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FLASK_APP=src/app.py | ||
FLASK_DEBUG=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Images manager for Fine Weather | ||
|
||
- Upload image | ||
- Edit image info (e.g. title, description) | ||
- Generate and provide a JSON output of images |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from fw_manager import create_app | ||
|
||
app = create_app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pathlib import Path | ||
|
||
from flask_bootstrap import Bootstrap5 | ||
from flask import Flask | ||
from flask_wtf import CSRFProtect | ||
|
||
from . import commands, blueprints | ||
from .models import db | ||
|
||
|
||
def create_app(): | ||
app = Flask(__name__, instance_path=Path("./instance").absolute()) | ||
app.config.from_prefixed_env() | ||
|
||
Bootstrap5(app) | ||
CSRFProtect(app) | ||
commands.init_app(app) | ||
db.init_app(app) | ||
blueprints.init_app(app) | ||
|
||
return app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from flask import Flask | ||
|
||
from fw_manager.blueprints.manager import manager_bp | ||
from fw_manager.blueprints.retriever import retriever_bp | ||
from fw_manager.blueprints.error import error_bp | ||
|
||
|
||
def init_app(app: Flask): | ||
app.register_blueprint(manager_bp, url_prefix="/manager") | ||
app.register_blueprint(retriever_bp, url_prefix="/images") | ||
app.register_blueprint(error_bp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from flask import Blueprint | ||
|
||
from fw_manager.utils import make_resp | ||
|
||
from loguru import logger | ||
|
||
error_bp = Blueprint("error", __name__) | ||
|
||
|
||
@error_bp.app_errorhandler(400) | ||
def bad_request(err): | ||
logger.error(f"Bad request: {err!r}") | ||
return make_resp(err_code="BAD_REQUEST", msg="Bad request"), 400 | ||
|
||
|
||
@error_bp.app_errorhandler(403) | ||
def not_authorized(err): | ||
logger.error(f"Not authorized: {err!r}") | ||
return make_resp(err_code="NOT_AUTHORIZED", msg="Not authorized"), 403 | ||
|
||
|
||
@error_bp.app_errorhandler(404) | ||
def not_found(err): | ||
logger.error(f"Not found: {err!r}") | ||
return make_resp(err_code="NOT_FOUND", msg="404 not found"), 404 | ||
|
||
|
||
@error_bp.app_errorhandler(500) | ||
def internal_server_error(err): | ||
logger.error(f"An error occurred: {err!r}") | ||
return make_resp(err_code="INTERNAL_ERROR", msg="An error occurred"), 500 |
Oops, something went wrong.