An example which is a static content management system. You can write a blog, a page and build it to a static website easily.
You should know a litle bit about jinja2 template engine. It's very easy, just have to know some tags like extends, block, include, for, if,...
- Python 3
- Pip
- Lekto
It's simple, just install lekto by pip
pip install lekto
If you start from nothing, you have to run quickstart first
lektor quickstart
And then run
lektor serve
lekto monitors your files so any change will apply immediately. Open link http://localhost:5000 and view your(or mine) website
I said that is's a static website, right? You don't need "serve" it by a python program, just build it to static content(maybe any thing your browsers can understand perfectly)
First, clean your build
lektor clean --yes
then, lets build it
lektor build
or
lektor build -f minify
Then, lektor build it to an folder. This is a part which I don't like lektor. It creates whole files to what the hell folder we can't know surely. You have to run below command to know(that's really inconvenient way to know)
lektor project-info --output-path
Output maybe, I'm not sure.
/Users/luanvv/.../build-cache/6fdaeecab78d6aa99f86f586ab15da06
mkdir build-minify && cp -r $(lektor project-info --output-path)/* build-minify/
Use Linux command to gzip. I donot know an alternative for Window OS
cd build-minify && find . -type f -exec gzip -9 "{}" \; -exec mv "{}.gz" "{}" \;
gsutil -m cp -R . gs://[DESTINATION_BUCKET_NAME]/
or you want to set cache-control and compress
gsutil -h "Cache-Control:public,max-age=86400" -h "Content-Encoding:gzip" -m cp -a public-read -r . gs://[DESTINATION_BUCKET_NAME]/
firebase deploy
Lektor provides an admin site(at link http://localhost:5000/admin), so you can create, edit and preview any blog/page here
If you want to use lektor with docker this amazing project will be your best friend
You must cd
into an alredy existing Lektor project.
To build the site:
docker run --rm -v $(pwd):/opt/lektor softinstigate/lektor build
To serve the site:
docker run --rm -v $(pwd):/opt/lektor -p 5000:5000 softinstigate/lektor server --host 0.0.0.0
When you ready for deployment
rm -rf build build-*
docker run --rm -v $(pwd):/opt/lektor softinstigate/lektor build -O build
firebase deploy
- Lektor - The static content management system used
- Jinja2 - Template engine
- SoftInstigate/lektor-docker
- Luan Vu - luanvuhlu