diff options
author | mjfernez <mjfernez@gmail.com> | 2021-10-14 20:14:53 -0400 |
---|---|---|
committer | mjfernez <mjfernez@gmail.com> | 2021-10-14 20:14:53 -0400 |
commit | c583a69362f86fcc8e1b35a45a06dd8377d6308f (patch) | |
tree | 30609b89aa2781c95fc5c04ff96db3ab063e16e7 /siteconfig.py | |
parent | f7668243b7a55d1f69d508b3baaf891055715f63 (diff) | |
download | ezcms-c583a69362f86fcc8e1b35a45a06dd8377d6308f.tar.gz |
Adds RSS auto-generation for files in 'site'
This commit adds rss_generator.py which contains the main logic for
indexing the site directory and generating a feed on startup. It serves
as a sort of ad-hoc database which is accessed when /feed.xml is
requested.
Also corrects various typos, README nonsense, and expands the config
options for RSS. Instances of './templates/site' have been replaced with
the general BASE_DIR variable in the siteconfig.
Diffstat (limited to 'siteconfig.py')
-rw-r--r-- | siteconfig.py | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/siteconfig.py b/siteconfig.py index 412dfce..f42875b 100644 --- a/siteconfig.py +++ b/siteconfig.py @@ -7,20 +7,30 @@ class siteconfig: # REQUIRED SETTINGS# DOMAIN = "example.net" # Your site here! - HOME_TITLE = "WELCOME" # Goes right under - # your site + HOME_TITLE = "WELCOME" LINKS_FILE = ".links" # ".lnx" if you like DESC_FILE = ".description" # ".desc" DEFAULT_MIMETYPE = "application/octet-stream" # ^This usually prompts a browser to download a file if the mime # type is unknown. A good alternative might be "text/plain" + # This setting is required, don't change it unless you're running + # things in different directories + BASE_DIR = "./templates/site/" # Add your desired mimetypes to the csv file MIMETYPES = {} with open('mimetypes.csv') as f: for line in f.readlines(): ext, mime = line.strip().split(',') MIMETYPES.update({ext: mime}) + # This reads your omit file. + # Entries should be the full path from the site directory. + # For example "dontread.txt" in this project is entered as + # 'thoughts/rants/donread.txt' + RSS_OMIT = [] + with open('omit') as f: + for line in f.readlines(): + RSS_OMIT.append(BASE_DIR + line.strip()) # OPTIONAL SETTINGS # @@ -33,35 +43,51 @@ class siteconfig: # Most of the time, you don't need to set this! SECRET_KEY = None # Something random. - # Option for Flask Compress + # Options for Flask Compress # see here https://pypi.org/project/Flask-Compress/ COMPRESS_MIMETYPES = list(MIMETYPES.values()) - # Option for Flask Caching + # Options for Flask Caching # https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching cache_config = { - 'CACHE_TYPE' : "SimpleCache", - 'CACHE_DEFAULT_TIMEOUT' : 300, + 'CACHE_TYPE': "SimpleCache", + 'CACHE_DEFAULT_TIMEOUT': 300, # You should only fill ONE of the sections below # uswgi - 'CACHE_UWSGI_NAME' : None, + 'CACHE_UWSGI_NAME': None, ## # memcache - 'CACHE_MEMCACHED_SERVERS' : None, - 'CACHE_MEMCACHED_USERNAME' : None, - 'CACHE_MEMCACHED_PASSWORD' : None, + '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, + '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, + 'CACHE_DIR': None, # add more options as needed from the URL above } + + # RSS Settings + rss_channel_config = { + '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': "editor@example.net", + 'WEBMASTER': "webmaster@example.net", + # Max amount of paragraphs to print in each description + 'DESCRIPTION_LENGTH': 3, + } |