Skip to main content

🔥 Create web applications easily — a Flask-powered micro-framework

Project description

🔥 WebForge

Create web applications easily — a minimal Flask-powered framework with clean syntax.

pip install WebForge
webforge new mon-site
cd mon-site
python backend/server/forge.py

Structure d'un projet WebForge

mon-site/
├── backend/
│   ├── requirements.txt
│   └── server/
│       └── forge.py        ← Cœur du serveur
└── public/
    ├── pages/
    │   └── index.html      ← Templates HTML
    ├── script/
    │   └── app.js          ← JavaScript client
    └── service/
        └── style.css       ← Fichiers statiques

Écrire forge.py

from WebForge import webforge, security, env as web

# Variables d'environnement
password = web.env("PASSWORD")
ip = "192.168.1.123"

# ─── Routes ──────────────────────────────────────
@web.app("/")
def index():
    web.route("style", "/public/service/style.css")
    return web.render("index.html")

@web.app("/login")
def login():
    return web.render("login.html")

# ─── Sécurité ────────────────────────────────────
@web.security("/")
def secure_home():
    if not web.password(password):      # vérif mot de passe en session
        return web.redirect("/login")
    if not web.ip(ip):                  # vérif IP
        return web.abort(403)

# ─── Démarrage ───────────────────────────────────
if __name__ == "__main__":
    web.runapp(debug=True, port=5000, host="0.0.0.0")

API complète

Routes

Fonction Description
@web.app("/path") Définit une route
@web.security("/path") Middleware de sécurité pour une route
web.route("name", "/path/to/file") Route vers un fichier statique

Réponses

Fonction Description
web.render("page.html", **ctx) Rend un template HTML
web.redirect("/url") Redirige vers une URL
web.abort(403) Retourne une erreur HTTP

Sécurité

Fonction Description
web.password("secret") Vérifie le mot de passe en session
web.ip("192.168.1.1") Vérifie l'IP du client (accepte aussi une liste)

Utilitaires

Fonction Description
web.env("VAR") Lit une variable d'environnement
web.runapp(debug, port, host) Démarre le serveur

CLI

webforge new <nom>    # Crée un nouveau projet
webforge run          # Lance le projet courant

Installation pour le développement

git clone https://github.com/yourname/webforge
cd webforge
pip install -e .

Licence

MIT

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-1.0.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

webforge-1.0.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for webforge-1.0.1.tar.gz
Algorithm Hash digest
SHA256 72846325649f8d14540e3be66e6f65dd159a0b03a9229308720e05d7f31ac0ef
MD5 210badb0d29cf08c5c4e3dd6d102d834
BLAKE2b-256 fc5ff77917665af88823a000fec042220ebcf7dc14290fcb3432bcab11369b34

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for webforge-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbee8993be9d0daad6f11db55396a8a71c09016fa0acd87e3bf1ad3825500e29
MD5 61e08db6b97c6e36e945ad072d567ac5
BLAKE2b-256 3255cecafb9a7365a12aa5ad028cc818aed552ac51e7760c830f8f9c59f10382

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