aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.README.swpbin0 -> 28672 bytes
-rw-r--r--.server.py.swpbin0 -> 16384 bytes
-rw-r--r--README54
-rw-r--r--server.py3
-rw-r--r--templates/.base.html.swpbin0 -> 12288 bytes
-rw-r--r--templates/.index.html.swpbin0 -> 12288 bytes
-rw-r--r--templates/index.html2
-rw-r--r--templates/site/.home.html.swpbin0 -> 12288 bytes
-rw-r--r--templates/site/.license.html.swpbin0 -> 12288 bytes
-rw-r--r--templates/site/fun/.renegade.html!.swpbin0 -> 12288 bytes
-rw-r--r--templates/site/fun/renegade.html!6
11 files changed, 52 insertions, 13 deletions
diff --git a/.README.swp b/.README.swp
new file mode 100644
index 0000000..8e1c84f
--- /dev/null
+++ b/.README.swp
Binary files differ
diff --git a/.server.py.swp b/.server.py.swp
new file mode 100644
index 0000000..700dc05
--- /dev/null
+++ b/.server.py.swp
Binary files differ
diff --git a/README b/README
index 5ebe3c9..9dc6c4c 100644
--- a/README
+++ b/README
@@ -31,6 +31,18 @@ Flask has great documentation so I think you'll find it a pleasure to build on
top of.
+### Why not just neocities?
+
+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.
+
+
## Quick start
It's recommended to run each server in it's own virtual environment. This
@@ -38,11 +50,12 @@ program uses python 3.7, so change `python` to either `python3` or `python3.7`
depending on your needs. First clone this repo (with git clone, or download the
zip), change into the directory, then:
-
-`python -m venv env`
-`pip install -r requirements.txt`
-`python server.py`
-
+```bash
+$ python -m venv env
+$ source env/bin/activate
+$ pip install -r requirements.txt
+$ python server.py
+```
Your server will (by default) be hosted on http://127.0.0.1:5000
@@ -119,6 +132,25 @@ You can of course link to external sites, but you must specify the protocol
a relative path like `example.net/google.com`.
+### Override base template
+
+Have a page with custom CSS, or need to get rid of the navbar entirely? No
+worries! Just add a '!' at the end of you html file and EZCMS will interpret it
+as it's own Jinja template without adding everything from the base template.
+Tip: if you're just changing the CSS, you can start with the following
+boilerplate:
+
+```code
+{% extends 'base.html' %}
+{% block css%}
+//your cool css here
+{% endblock %}
+{% block content %}
+//your cool content here
+{% endblock %}
+```
+
+
### Making Secret Directories and Files
This program follows the Unix convention of placing a "." before directories
@@ -156,8 +188,8 @@ replace the HTML with your own license (or none), by editing
There are a few special directories linked that are needed to
customize your site. First the `static` directory, which holds your static
files like CSS templates and images. Second the `raw` directory, which allows
-the user to access files the `templates/site` as raw files instead of HTML.
-You can disable it by deleting the code under `send_file_from_site` or
+the user to access files the `templates/site` as raw files instead of HTML.
+You can disable it by deleting the code under `send_file_from_site` or
`send_file_from_static` in `server.py`.
@@ -168,10 +200,10 @@ an appropriate container. Refer to https://flask.palletsprojects.com/en/2.0.x/de
for options, but an easy option I like is to use uwsgi since it's well
documented.
-
-`python -m venv env`
-`pip install uwsgi`
-`doas -u www uwsgi -s /var/path/to/your-flask.sock --manage-script-name --mount /=server:app --virtualenv ./env`
+```bash
+$ sudo pip install uwsgi
+$ uwsgi -s /var/path/to/your-flask.sock --manage-script-name --mount /=server:app --virtualenv ./env
+```
Then point your main http daemon (niginx, apache, httpd) to the socket you
made. There are examples for a nginx configuration in the uWSGI and Flask docs:
diff --git a/server.py b/server.py
index 21ecb2f..15514ba 100644
--- a/server.py
+++ b/server.py
@@ -121,8 +121,9 @@ def render_file(path):
if abs_path.endswith('.html'):
with open(abs_path) as f:
content = f.read()
- print(path.split('/')[-2] + '/')
return render_template_string(CONTENT_BLOCK.replace('$', content), **context)
+ elif abs_path.endswith('.html!'):
+ return render_template("site/" + path, **context)
else:
# not an html file, so don't render it
return send_from_directory('templates/site/', path,
diff --git a/templates/.base.html.swp b/templates/.base.html.swp
new file mode 100644
index 0000000..9720cba
--- /dev/null
+++ b/templates/.base.html.swp
Binary files differ
diff --git a/templates/.index.html.swp b/templates/.index.html.swp
new file mode 100644
index 0000000..87ff2f1
--- /dev/null
+++ b/templates/.index.html.swp
Binary files differ
diff --git a/templates/index.html b/templates/index.html
index 7e815e2..4bbad1d 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -13,7 +13,7 @@
{% if files %}
<h3>File Listing</h3>
{% for f in files %}
-<li><a href="{{ cur_dir }}{{ f }}">{{ f }}</a></li>
+<li><a href="{{ cur_dir }}{{ f }}">{{ f.rstrip('!') }}</a></li>
{% endfor %}
{% endif %}
diff --git a/templates/site/.home.html.swp b/templates/site/.home.html.swp
new file mode 100644
index 0000000..b2cc13b
--- /dev/null
+++ b/templates/site/.home.html.swp
Binary files differ
diff --git a/templates/site/.license.html.swp b/templates/site/.license.html.swp
new file mode 100644
index 0000000..d1b0b90
--- /dev/null
+++ b/templates/site/.license.html.swp
Binary files differ
diff --git a/templates/site/fun/.renegade.html!.swp b/templates/site/fun/.renegade.html!.swp
new file mode 100644
index 0000000..6d77db2
--- /dev/null
+++ b/templates/site/fun/.renegade.html!.swp
Binary files differ
diff --git a/templates/site/fun/renegade.html! b/templates/site/fun/renegade.html!
new file mode 100644
index 0000000..cc1e6f8
--- /dev/null
+++ b/templates/site/fun/renegade.html!
@@ -0,0 +1,6 @@
+<html>
+ <body>
+ <h1>This file breaks all the rules!</h1>
+ <p>This file doesn't use the base template.</p>
+ </body>
+</html>