diff options
-rw-r--r-- | README | 48 | ||||
-rw-r--r-- | server.py | 7 | ||||
-rw-r--r-- | siteconfig.py | 30 |
3 files changed, 45 insertions, 40 deletions
@@ -7,28 +7,15 @@ Python 3.7+ ## Huh/What/Why? -EZCMS (or "Easy CMS" for those of you who call that "zed" instead) is a minimal -and simple way of managing content and serving static files on a website. It -was mostly made for my own website which I wanted to be simple, but with some -ability to easily add new pages in a template I like. - -EZCMS is designed around the idea that web servers are really just glorified -file cabinets and draws heavily from the Unix philosophy of "everything is a -file". When a user finds a site managed by this program, they are primarily -greeted with a series of folders and files, but in a neat and easy to -understand index. Each folder--preferably labeled appropriately so users -know what they're links to other sites--will index itself on click, containing -a short description of the directory, sub-directories, files, and links -elsewhere. - -Why not just use a database or the million other CMS software packages out -there? Zero reason not to! I just wanted to see what it would look like to -build something from the ground up WITHOUT having to copy HTML over and over -again. Databases are great, but so are file systems, and I see no reason to -overcomplicate when making a simple home page. This software is primarily -geared towards bloggers or people who want a home page like it's 1999, but -Flask has great documentation so I think you'll find it a pleasure to build on -top of if you want to get creative. +EZCMS (or "Easy CMS" for those of you who call that "zed" instead) is a +minimal and simple way of managing content and serving static files on +a website. It was mostly made for my own website which I wanted to be +as simple as possible, but with some ability to easily add new pages in +a template I like. + +I don't really expect many people to use this, but I hope it might be +useful for someone learning to use Flask, or someone who also likes the +look of websites from the 90s. ### Why not just neocities? @@ -37,11 +24,8 @@ Neocities is awesome! You should definitely host a site there. https://neocities.org/ -It's easy to get a simple static site going there and it's totally free, but it -lacks server side scripting and a truly self-hosted option. This program gives -you a nice static base to start from, with the ability to script up you own -templates and whatever else Flask has to offer. - +It's easy to get a simple static site going there and it's totally +free, but it lacks server side scripting as far as I know. ## Quick start @@ -200,8 +184,10 @@ You can disable it by deleting the code under `send_file_from_site` or ## Deploying a server You should NOT run this server as in the quick start, but instead deploy it in -an appropriate container. Refer to https://flask.palletsprojects.com/en/2.0.x/deploying/ -for options, but an easy option I like is to use uwsgi since it's well +an appropriate container. + +Refer to https://flask.palletsprojects.com/en/2.0.x/deploying/ +for options, but an easy option I use is uwsgi since it's well documented. A quickstart looks like this: ```bash @@ -218,7 +204,7 @@ made. There are examples for a nginx configuration in the uWSGI and Flask docs: - https://flask.palletsprojects.com/en/2.0.x/deploying/uwsgi/ -I personally recommend making an ini file so you can run `uwsgi --ini yourini.ini` +I recommend making an ini file so you can run `uwsgi --ini yourini.ini` without all the extra arguments. A simple ini file, which I stole from [here](https://github.com/mking/flask-uwsgi), looks like this: @@ -233,3 +219,5 @@ die-on-term = true processes = 4 logger = file:/var/www/logs/uwsgi.log ``` + +Be sure to follow that link above for a full explanation. @@ -9,12 +9,7 @@ from flask_caching import Cache app = Flask(__name__) compress = Compress() -cache = Cache( - config={ - 'CACHE_TYPE': siteconfig.CACHE_TYPE, - 'CACHE_DEFAULT_TIMEOUT': siteconfig.CACHE_DEFAULT_TIMEOUT, - } -) +cache = Cache(config=siteconfig.cache_config) from views import * diff --git a/siteconfig.py b/siteconfig.py index 4e0ef90..412dfce 100644 --- a/siteconfig.py +++ b/siteconfig.py @@ -39,7 +39,29 @@ class siteconfig: # Option for Flask Caching # https://flask-caching.readthedocs.io/en/latest/#configuring-flask-caching - CACHE_TYPE = "SimpleCache" - - # Time in seconds that your files stay cached for - CACHE_DEFAULT_TIMEOUT = 300 + cache_config = { + 'CACHE_TYPE' : "SimpleCache", + 'CACHE_DEFAULT_TIMEOUT' : 300, + # 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 + } |