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.3.tar.gz (7.4 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.3-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: webforge-1.0.3.tar.gz
  • Upload date:
  • Size: 7.4 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.3.tar.gz
Algorithm Hash digest
SHA256 578f7577c984a95c206d2a190cfce786da4d91d9aa7a15c74a3869da545d9b50
MD5 d68032b4ff575122ae61dd47ee9f6661
BLAKE2b-256 f396c55d6289afb7b8411819990b112bcd57b249d1accf76b27d78b1fc698668

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webforge-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ef106045a42f50a233ecce23d027235b5509dcbf684f70894b2f6f9a77be4763
MD5 344fd6dd3546edfa262261703371e138
BLAKE2b-256 9e8f6a327ea3dc624e6678b2b589d7c72f7b8a4ffb1bc87c92fb99518f3b16cc

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