This is a simple http server, use MVC like design.
Project description
Naja Atra WSGI
This ia a WSGI proxy that proxies requests to Naja Atra.
Usage
from naja_atra import route
from naja_atra_wsgi import app
from wsgiref.simple_server import make_server
@route("/hello")
def hello(name: str):
return {"messag": f"Hello, {name}!"}
if __name__ == '__main__':
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
You can use server.scan()
to import routes from other modules. And also you can use naja_atra_wsgi.config()
to function to sepecify the static resources routes.
import os
import naja_atra.server as server
from wsgiref.simple_server import make_server
from naja_atra_wsgi import config, app
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
if __name__ == '__main__':
server.scan(base_dir="tests/ctrls", regx=r'.*controllers.*')
config(resources={"/public/*": f"{PROJECT_ROOT}/tests/static",
"/*": f"{PROJECT_ROOT}/tests/static"})
wsgi_server = make_server("", 9090, app)
wsgi_server.serve_forever()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
naja-atra-wsgi-1.0.2.tar.gz
(6.8 kB
view details)
Built Distribution
File details
Details for the file naja-atra-wsgi-1.0.2.tar.gz
.
File metadata
- Download URL: naja-atra-wsgi-1.0.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfebbbf49846f28cd5d908c95f1cbafe78754d6d59753763efb4e990897996f5 |
|
MD5 | ca16480a58a36b012d41889049972245 |
|
BLAKE2b-256 | e33eb74a85cee000a4f765d8596e58993d9a4f3c9dd881d8e767c03119c8428e |
File details
Details for the file naja_atra_wsgi-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: naja_atra_wsgi-1.0.2-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9007497a8cb5979ddc9f3d0f60be628fc0c6b97e6d9debbe3859822cc5fa2758 |
|
MD5 | 1ae007458a1553186a2669d6c8917565 |
|
BLAKE2b-256 | 9b09ebaafa30c58de7dc28c291cdde19f6f4d079f85029abaa1ada8de0b33d38 |