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.4.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.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: webforge-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 8489ef7089a1816880d1ee29f415dfc2f86db923e504935748feb501989118cb
MD5 3e7666604973f866d45b9d6d171f814e
BLAKE2b-256 4573bdcd790504d4b999de47ac25c4fee6bca85aab8fd06a36b3981854e8b46f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webforge-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b2afe83b9545b0169e3f7f1def4bf9f8c83a0aded6dccf8334164c2988982b0
MD5 c45b7d64a96d39688570d158d1baa88c
BLAKE2b-256 8ea48b151094e24a04034a5cfd4b96f5e800a21f5e6a3148574ebc0598f702cf

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