Coder Social home page Coder Social logo

test's Introduction

Kaktos Logo

Python static site generator


κάκτος

Kaktos

Kaktos is a python static site generator.

The idea is create a simple static site generator for people that don't need server-side languages.

Designers can use it too, since it don't need people that know a programming language.

Demo

Cloudflare:

https://kaktos.pages.dev

Netlify:

https://kaktos.netlify.app

Amplify:

https://main.d27ze19drzixy0.amplifyapp.com

Requirements

  • Python 3.8+

Setup

Install python dependencies:

python3 -m pip install -r requirements.txt

Development

To work in development mode, you only need execute one command:

python3 kaktos.py

When you change any file locally, the server will process it again and auto-refresh on browser.

This command always force use development mode, with or without environment variable.

Production

To generate production files, you only need execute one command:

python3 kaktos.py build

All files will be generated in build folder.

If you set environment variable KAKTOS_DEBUG=True, kaktos will build all files for development mode, example:

KAKTOS_DEBUG=True python3 kaktos.py build

Deploy

Netlify:

Deploy to Netlify

Structure

  • kaktos.py = main file that process your command
  • requirements.txt = python dependency list
  • templates/layouts = folder for all layouts that pages can inherit
  • templates/pages = folder for pages that will be generated
  • templates/shared = folder for parts of layouts that can be shared with other layouts
  • modules = kaktos modules
  • modules/config.py = configuration file
  • files = folder that contains all assets and custom files

Templates

All templates (html files) are based on Jinja2 library. You can see it here:

https://jinja.palletsprojects.com/en/3.0.x/

Troubleshooting

• Python version

Each service that build the static content automatically use a specific python version.

If you need change the python version used to build all files and pages, edit file runtime.txt and change to 3.8, 3.9 or other.

These services that im using have this python version:

• Template changed, but not reloaded

Invalid Jinja2 syntax can prevent your HTML template from being built.

Check your terminal to see the error message, the HTML file and the line number where invalid syntax was detected.

Buy me a coffee

Buy Me a Coffee at ko-fi.com

Images

All images for demo i got from:

https://unsplash.com/

License

MIT

Copyright (c) 2021-2024, Paulo Coutinho

test's People

Contributors

paulocoutinhox avatar

Stargazers

Anders Hedborg avatar

Watchers

Anders Hedborg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.