diff options
-rw-r--r-- | rss_generator.py | 4 | ||||
-rw-r--r-- | server.py | 5 | ||||
-rw-r--r-- | siteconfig.py | 45 | ||||
-rw-r--r-- | view_functions.py | 2 | ||||
-rw-r--r-- | views.py | 4 |
5 files changed, 13 insertions, 47 deletions
diff --git a/rss_generator.py b/rss_generator.py index eb4ca82..bde4645 100644 --- a/rss_generator.py +++ b/rss_generator.py @@ -1,5 +1,5 @@ import os -from time import strftime, strptime, ctime +from time import strftime, strptime from siteconfig import siteconfig from view_functions import is_hidden_path, file_last_modified @@ -9,7 +9,7 @@ class RSS_Item: RSS_Item - a (very) basic implementation of an object in an RSS feed using only essential parameters as specified in: https://www.rssboard.org/rss-specification#hrelementsOfLtitemgt - + Item data is generated from a given file path """ PARAGRAPHS = siteconfig.rss_channel_config['DESCRIPTION_LENGTH'] @@ -4,12 +4,10 @@ server.py - sets up and runs the flask server from flask import Flask from siteconfig import siteconfig from flask_compress import Compress -from flask_caching import Cache -from rss_generator import RSS_Item, get_rss_channel +from rss_generator import get_rss_channel app = Flask(__name__) compress = Compress() -cache = Cache(config=siteconfig.cache_config) from views import * @@ -33,6 +31,5 @@ def setup(): # Setup needs to come first to be compatible with wsgi setup() compress.init_app(app) -cache.init_app(app) if __name__ == "__main__": app.run() diff --git a/siteconfig.py b/siteconfig.py index aa03597..4a653d4 100644 --- a/siteconfig.py +++ b/siteconfig.py @@ -8,8 +8,8 @@ from config import config class siteconfig(config): # REQUIRED SETTINGS # - DOMAIN = "mjfer.net" # Your site here! - HOME_TITLE = "welcome" + DOMAIN = "example.net" # Your site here! + HOME_TITLE = "WELCOME" LINKS_FILE = ".links" # ".lnx" if you like DESC_FILE = ".description" # ".desc" DEFAULT_MIMETYPE = "application/octet-stream" @@ -25,7 +25,7 @@ class siteconfig(config): MAIN_SITE_DIRS = sorted( config.DEFAULT_SITE_DIRS ) # ["dir1", "dir2", "dir3"] - MAIN_SITE_DIRS.remove("files") + # Set a custom secret key. If not set, it will be generated # Most of the time, you don't need to set this! SECRET_KEY = config.GENERATED_SECRET_KEY # replace with random number. @@ -34,47 +34,18 @@ class siteconfig(config): # see here https://pypi.org/project/Flask-Compress/ COMPRESS_MIMETYPES = list(config.MIMETYPES.values()) - # Options for Flask Caching - # https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching - cache_config = { - 'CACHE_TYPE': "SimpleCache", - 'CACHE_DEFAULT_TIMEOUT': 10, - # You should only fill ONE of the sections below - # uswgi - 'CACHE_UWSGI_NAME': None, - ## - # memcache - 'CACHE_MEMCACHED_SERVERS': None, - 'CACHE_MEMCACHED_USERNAME': None, - 'CACHE_MEMCACHED_PASSWORD': None, - ## - # redis - 'CACHE_REDIS_HOST': None, - 'CACHE_REDIS_PORT': None, - 'CACHE_REDIS_PASSWORD': None, - 'CACHE_REDIS_DB': None, - 'CACHE_REDIS_URL': None, - 'CACHE_REDIS_SENTINELS': None, - 'CACHE_REDIS_SENTINEL_MASTER': None, - 'CACHE_REDIS_CLUSTER': None, - ## - # filesystem - 'CACHE_DIR': None, - # add more options as needed from the URL above - } - # RSS Settings rss_channel_config = { - 'TITLE': "mjfer.net RSS Feed", - 'LINK': "https://mjfer.net/feed.xml", - 'DESCRIPTION': "feed organized by the latest updated files", + 'TITLE': "RSS Feed for example.net", + 'LINK': "http://127.0.0.1:5000/", + 'DESCRIPTION': "My example feed", 'LANGUAGE': "en-us", 'PUBDATE': "", 'LASTBUILDDATE': "", 'DOCS': "https://git.mjfer.net/ezcms.git/", 'GENERATOR': "EZCMS", - 'AUTHOR': "mjf@mjfer.net", - 'WEBMASTER': "mjf@mjfer.net", + 'AUTHOR': "editor@example.net", + 'WEBMASTER': "webmaster@example.net", # Max amount of paragraphs to print in each description 'DESCRIPTION_LENGTH': 3, # File extensions to include in RSS updates diff --git a/view_functions.py b/view_functions.py index 960271f..3de8687 100644 --- a/view_functions.py +++ b/view_functions.py @@ -3,7 +3,7 @@ view_functions.py - defines functions called by views to display the correct dat about files and paths. """ import os -from time import strftime, strptime, ctime +from time import ctime from siteconfig import siteconfig @@ -6,7 +6,7 @@ import os from flask import send_from_directory, abort from flask import render_template, render_template_string, make_response from siteconfig import siteconfig -from server import app, cache +from server import app from view_functions import * # bit of a hack. @@ -20,7 +20,6 @@ CONTENT_BLOCK = ( @app.route("/") @app.route("/home.html") @app.route("/index.html") -@cache.cached() def home(): """ home - renders the template `home.html` as the main index file @@ -37,7 +36,6 @@ def home(): # from: https://pythonise.com/series/learning-flask/sending-files-with-flask @app.route("/<path:path>") -@cache.cached() def render_file(path): """ render_file - renders an HTML document for the given `path`. |