|
@ -1,4 +1,5 @@ |
|
|
import flask_apscheduler |
|
|
import flask_apscheduler |
|
|
|
|
|
from feedgen.feed import FeedGenerator |
|
|
from flask import Flask |
|
|
from flask import Flask |
|
|
from flask_migrate import Migrate |
|
|
from flask_migrate import Migrate |
|
|
from flask_sqlalchemy import SQLAlchemy |
|
|
from flask_sqlalchemy import SQLAlchemy |
|
@ -19,4 +20,17 @@ def create_app(): |
|
|
db.init_app(APP) |
|
|
db.init_app(APP) |
|
|
migrate.init_app(APP, db, render_as_batch=True) |
|
|
migrate.init_app(APP, db, render_as_batch=True) |
|
|
|
|
|
|
|
|
|
|
|
@scheduler.task("interval", id="update", minutes=10) |
|
|
|
|
|
def update(): |
|
|
|
|
|
create_rss_feed() |
|
|
|
|
|
|
|
|
return APP |
|
|
return APP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_rss_feed(): |
|
|
|
|
|
print("creating rss feed") |
|
|
|
|
|
fg = FeedGenerator() |
|
|
|
|
|
atomfeed = fg.atom_str(pretty=True) |
|
|
|
|
|
rssfeed = fg.rss_str(pretty=True) |
|
|
|
|
|
fg.atom_file("atom.xml") |
|
|
|
|
|
fg.rss_file("rss.xml") |
|
|