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.0.tar.gz (7.9 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.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: webforge-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 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.0.tar.gz
Algorithm Hash digest
SHA256 ee9818951ce92568f9532fa659a48b56daf1e23df88a1eb5afbf750bd9ca8cf2
MD5 5fdf772a458bcb89059974dcd3714bf6
BLAKE2b-256 77e2d351ad00960cca276cfda23555bdb8b7bf6f558dee77fa49d28ac7e5984e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webforge-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccfcb947f6611398f1d931340287c40c78e346ac1a4635f50b6e1f4160171307
MD5 c2b8819e9c16b2d9e72a8c21bb7d4b04
BLAKE2b-256 20072e8e3dec1c61bb3275a25ef5332857dcf522e94793297f32408d23010bb2

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