Skip to content

Commit

Permalink
fix: frontend blueprints now work, lets start adding templates and re…
Browse files Browse the repository at this point in the history
…sources

Signed-off-by: miigotu <miigotu@gmail.com>
  • Loading branch information
miigotu committed Nov 4, 2023
1 parent 734be5f commit 2ce5196
Show file tree
Hide file tree
Showing 22 changed files with 355 additions and 105 deletions.
31 changes: 24 additions & 7 deletions frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,35 @@

from flask import Flask

from .config import config_blueprint
from .shows import shows_blueprint
from .movies import movies_blueprint

from .utils import logger
from .config import blueprint as config_blueprint
from .movies import blueprint as movies_blueprint
from .shows import blueprint as shows_blueprint

from logging.config import dictConfig

dictConfig({
'version': 1,
'formatters': {'default': {
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s',
}},
'handlers': {'wsgi': {
'class': 'logging.StreamHandler',
'stream': 'ext://flask.logging.wsgi_errors_stream',
'formatter': 'default'
}},
'root': {
'level': 'DEBUG',
'handlers': ['wsgi']
}
})


class FlaskServer(threading.Thread):
"""Flask application class to set up the sickchill flask webserver interface"""

def __init__(self, host, port):
super().__init__(name="FLASK")
self.app = None
self.host = host
self.port = port
self.daemon = True
Expand All @@ -26,13 +43,13 @@ def __init__(self, host, port):
def run(self):
"""Run the flask server"""
self.app = Flask("SickFlask", template_folder="frontend/templates", static_folder="frontend/static", static_url_path="/static")
self.app.config.from_object("frontend.app.DevelopmentConfig")
self.app.config.from_object(DevelopmentConfig)

self.app.register_blueprint(config_blueprint)
self.app.register_blueprint(shows_blueprint)
self.app.register_blueprint(movies_blueprint)
routes = "\n\t\t".join(f"{rule}" for rule in self.app.url_map.iter_rules())
logger.debug(f"{self.app.name} Route:\n\t\t{routes}")
self.app.logger.debug(f"{self.app.name} Route:\n\t\t{routes}")

self.app.run(host=self.host, port=self.port, use_reloader=False)

Expand Down
4 changes: 1 addition & 3 deletions frontend/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
This module implements the web interface for the sickchill configurationt
"""

from frontend.utils import build_blueprint

config_blueprint = build_blueprint(__file__, __name__)
from .views import blueprint
32 changes: 32 additions & 0 deletions frontend/config/static/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ "./config.jsx":
/*!********************!*\
!*** ./config.jsx ***!
\********************/
/***/ (() => {

eval("\n\n//# sourceURL=webpack:///./config.jsx?");

/***/ })

/******/ });
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./config.jsx"]();
/******/
/******/ })()
;
11 changes: 11 additions & 0 deletions frontend/config/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask import Blueprint, render_template

from sickchill import logger, settings

blueprint = Blueprint("config", __name__, template_folder="templates", static_folder="static", url_prefix="/config")


@blueprint.route("/")
def config():
logger.info("Loading config page")
return render_template("config.html")
Empty file removed frontend/config/views/__init__.py
Empty file.
11 changes: 0 additions & 11 deletions frontend/config/views/config.py

This file was deleted.

4 changes: 1 addition & 3 deletions frontend/movies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
This module implements the web interface for the sickchill movies media type
"""

from frontend.utils import build_blueprint

movies_blueprint = build_blueprint(__file__, __name__)
from .views import blueprint
32 changes: 32 additions & 0 deletions frontend/movies/static/movie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ "./movie.jsx":
/*!*******************!*\
!*** ./movie.jsx ***!
\*******************/
/***/ (() => {

eval("\n\n//# sourceURL=webpack:///./movie.jsx?");

/***/ })

/******/ });
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./movie.jsx"]();
/******/
/******/ })()
;
32 changes: 32 additions & 0 deletions frontend/movies/static/movies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ "./movies.jsx":
/*!********************!*\
!*** ./movies.jsx ***!
\********************/
/***/ (() => {

eval("\n\n//# sourceURL=webpack:///./movies.jsx?");

/***/ })

/******/ });
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = {};
/******/ __webpack_modules__["./movies.jsx"]();
/******/
/******/ })()
;
18 changes: 18 additions & 0 deletions frontend/movies/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from flask import Blueprint, render_template

from sickchill import logger, settings

# from sickchill.movies import movie

blueprint = Blueprint("movies", __name__, template_folder="templates", static_folder="static", url_prefix="/movies")


@blueprint.route("/")
def movies():
logger.info("Loading movies page")
blueprint.logger.info("Loaded movies page")

logger.debug(f"movies: {settings.showList}")
blueprint.logger.debug(f"movies: {settings.movie_list}")

return render_template("movies.html", movies=settings.movie_list)
Empty file removed frontend/movies/views/__init__.py
Empty file.
18 changes: 0 additions & 18 deletions frontend/movies/views/movies.py

This file was deleted.

4 changes: 1 addition & 3 deletions frontend/shows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
This module implements the web interface for the sickchill shows media type
"""

from frontend.utils import build_blueprint

shows_blueprint = build_blueprint(__file__, __name__)
from .views import blueprint
8 changes: 8 additions & 0 deletions frontend/shows/static/show.css

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions frontend/shows/static/show.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({

/***/ "./show.jsx":
/*!******************!*\
!*** ./show.jsx ***!
\******************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var bootstrap_dist_css_bootstrap_min_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bootstrap/dist/css/bootstrap.min.css */ \"../../../../node_modules/bootstrap/dist/css/bootstrap.min.css\");\n\n\n//# sourceURL=webpack:///./show.jsx?");

/***/ }),

/***/ "../../../../node_modules/bootstrap/dist/css/bootstrap.min.css":
/*!*********************************************************************!*\
!*** ../../../../node_modules/bootstrap/dist/css/bootstrap.min.css ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack:///../../../../node_modules/bootstrap/dist/css/bootstrap.min.css?");

/***/ })

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./show.jsx");
/******/
/******/ })()
;
8 changes: 8 additions & 0 deletions frontend/shows/static/shows.css

Large diffs are not rendered by default.

Loading

0 comments on commit 2ce5196

Please sign in to comment.