Jinja for Python Simple Http Server
What's this?
This is a Jinja extension for pythone simple http server (https://github.com/keijack/python-simple-http-server)
How to use?
install
python3 -m pip install simple_http_server_jinja
from simple_http_server import route, server
from simple_http_server_jinja import JinjaView, render
@route("/index")
def index(name: str = "world"):
return JinjaView("index.html", {"name": name})
@route("/page")
def page():
return 200, render("page.html", {"a": "b"})
def main():
server.start(port=9090)
if __name__ == "__main__":
main()
For the above code, the templates should be placed in the templates folder in your project's root.
|--templates
|----index.html
|----page.html
|--main.py
You can set your own Jinja2 Environment via set_env function:
from simple_http_server import route, server
from simple_http_server_jinja import JinjaView, set_env
from jinja2 import Environment, FileSystemLoader
@route("/index")
def index(name: str = "world"):
return JinjaView("index.html", {"name": name})
def main():
env = Environment(loader=FileSystemLoader("/you/own/template/folder"))
set_env(env)
server.start(port=9090)
if __name__ == "__main__":
main()
Metadata
Release files for simple-http-server-jinja 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple_http_server_jinja-0.1.1.tar.gz | 3.4 kB | Without provenance | Details for simple_http_server_jinja-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_http_server_jinja-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for simple_http_server_jinja-0.1.1-py3-none-any.whl |
Total release size: 8.2 kB
Release files / simple_http_server_jinja-0.1.1.tar.gz
| Download URL | simple_http_server_jinja-0.1.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00c538de8638e26544638e02a84396ff39a852013cf709ec40cd20f3b15ec8b9
|
|
BLAKE2b-256 checksum How to use checksums |
48b202b0f7a423116842a49a7f6d0821ecc356866ff71c233c663c8196aaf411
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / simple_http_server_jinja-0.1.1-py3-none-any.whl
| Download URL | simple_http_server_jinja-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97073847c7afbb0ab3ad57fc9feba39f50909974a92eba89ac0b8d0810660e1a
|
|
BLAKE2b-256 checksum How to use checksums |
e6bd0b2e1a207f040f07b9b788511a90d6d12ea42927d8d0664dd9b3c7df03d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for simple-http-server-jinja 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.