Skip to main content

Un framework web minimaliste et indépendant

Project description

WebForge

WebForge is a lightweight, dependency-free Python mini-framework for building small websites and simple web apps with a very small API.

It lets you:

  • register routes for HTML pages
  • serve static assets such as CSS and JavaScript
  • protect routes with a simple password gate
  • run a small local HTTP server with the Python standard library

Features

  • Simple route registration with WebForge.route() or WebForge.new_route()
  • Easy security setup with WebForge.set_password()
  • Minimal built-in server via WebForge.run()
  • No external web framework dependency required

Installation

pip install webforge

Quick Start

from webforge import WebForge

app = WebForge(__name__)

@WebForge.apps
def apps():
    WebForge.new_route("/", "index.html")
    WebForge.route("/login", "login.html")

@WebForge.security
def secs():
    WebForge.set_password("/", "password", "/login")

if __name__ == "__main__":
    WebForge.run(port=5000, host="0.0.0.0")

Project Layout

Create a Public folder in your project and organize your files like this:

Public/
├── Render/
│   ├── index.html
│   └── login.html
└── Style/
    └── main.css
  • HTML pages should be placed in Public/Render/
  • CSS and JavaScript files can be served from Public/Style/ or Public/src/

Route Example

WebForge.new_route("/", "index.html")
WebForge.route("/about", "about.html")

The route() method is simply an alias of new_route().

Security Example

WebForge.set_password("/admin", "secret123", "/login")

This lets you protect a route by requiring the password=... cookie to be present.

Run the App

python your_app.py

Then open your browser at:

http://localhost:5000/

License

This project is distributed under the MIT License.

Status

WebForge is a small experimental framework intended for learning, lightweight internets, and simple personal site projects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webforge-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webforge-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file webforge-0.1.0.tar.gz.

File metadata

  • Download URL: webforge-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for webforge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 08f5453b94817b46c78d1b959fa816350997397e7d151cb869839d0825de5fed
MD5 0edf20a8431b92051069263ee7b829f8
BLAKE2b-256 1aabb2aa814e270e808640e334f8602803c14a46acb617b64859f0f86c4a9a81

See more details on using hashes here.

File details

Details for the file webforge-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: webforge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for webforge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3156d227ddeb43aaf9224c6a8640c33e3372a68159bc190d8e24fe56477dbb3e
MD5 f001b33f300ed5cb4de3805b9003afab
BLAKE2b-256 5ad8b77b18211a28ed5dc172f36734d7d1097137a6465f3e3109be5cb2bf84d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page