diff --git a/.gitignore b/.gitignore index 820e8a1..74053dc 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ pip-wheel-metadata/ test/* *.db +instance/* +static/* diff --git a/deploydb.py b/deploydb.py index 11f929f..f6ede11 100644 --- a/deploydb.py +++ b/deploydb.py @@ -1,11 +1,11 @@ def deploy(): """Run deployment of database.""" from flask_migrate import init, migrate, stamp, upgrade - - from app import create_app, db # This model is required for flask_migrate to make the table from postmodel import Post # noqa: F401 + from app import create_app, db + app = create_app() app.app_context().push() db.create_all() diff --git a/scheduler/schedule_text.py b/scheduler/schedule_text.py index b78cc99..adbd9f6 100644 --- a/scheduler/schedule_text.py +++ b/scheduler/schedule_text.py @@ -7,7 +7,21 @@ from sqlalchemy.exc import (DatabaseError, DataError, IntegrityError, InterfaceError, InvalidRequestError) -def schedule_text(request): +def schedule_post(request): + if request.form["text"]: + return _schedule_text(request) + if request.form["file"]: + return _schedule_file(request) + + return "no correct header found" + + +def _schedule_file(request): + print(request.form["file"]) + return "not yet implemented" + + +def _schedule_text(request): print(request.form["text"]) try: text = request.form["text"] diff --git a/start.py b/start.py index 0c074d1..aa04c42 100644 --- a/start.py +++ b/start.py @@ -1,8 +1,8 @@ import flask_apscheduler -from flask import Blueprint, Flask, request +from flask import request from app import create_app -from scheduler.schedule_text import schedule_text +from scheduler.schedule_text import schedule_post from updater import update_rss_feed APP = create_app() @@ -25,8 +25,8 @@ def index(): @APP.route("/schedule", methods=["POST"]) -def schedule_post(): - return schedule_text(request) +def schedule(): + return schedule_post(request) if __name__ == "__main__": diff --git a/static/atom.xml b/static/atom.xml deleted file mode 100644 index 812f5ac..0000000 --- a/static/atom.xml +++ /dev/null @@ -1,2 +0,0 @@ - -http://crunk.websiteCrunk website2023-10-03T18:20:53.506614+00:00python-feedgenSome things crunk is doing! \ No newline at end of file diff --git a/static/rss.xml b/static/rss.xml deleted file mode 100644 index 3527120..0000000 --- a/static/rss.xml +++ /dev/null @@ -1,2 +0,0 @@ - -Crunk websitehttp://crunk.website/test.atomSome things crunk is doing!http://www.rssboard.org/rss-specificationpython-feedgenenTue, 03 Oct 2023 18:20:53 +0000 \ No newline at end of file diff --git a/updater.py b/updater.py index 1cbd122..8ec60aa 100644 --- a/updater.py +++ b/updater.py @@ -32,7 +32,5 @@ def create_rss_feed(): def write_rss_feed(fg): - atomfeed = fg.atom_str(pretty=True) - rssfeed = fg.rss_str(pretty=True) fg.atom_file("static/atom.xml") fg.rss_file("static/rss.xml")