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

Uploaded Python 3

File details

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

File metadata

  • Download URL: webforge-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4e2b4e37781003079f60ece2174a0979ce791b64c41ad87474ea320c0f6438a9
MD5 b6124498d2dc369b5485c5f5feb6258e
BLAKE2b-256 8ca82ef3988e65f1a7e61587bcd657794596922fc0285f17ddf11e797320e68b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webforge-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4250d4237809dcee34004461791fbc4befffe2aab611e8f963f994343f5ed738
MD5 3c82e29cb3acee6be4ef56b6ff4a428d
BLAKE2b-256 cf4ad7d1aa33c5e590ffca67936fbaec8c14ef3b3cd2b032f3ad794eb13bb403

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