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()
Metadata
Release files for naja-atra-wsgi 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| naja-atra-wsgi-1.0.2.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| naja_atra_wsgi-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / naja-atra-wsgi-1.0.2.tar.gz
| Download URL | naja-atra-wsgi-1.0.2.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfebbbf49846f28cd5d908c95f1cbafe78754d6d59753763efb4e990897996f5
|
|
BLAKE2b-256 checksum How to use checksums |
e33eb74a85cee000a4f765d8596e58993d9a4f3c9dd881d8e767c03119c8428e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / naja_atra_wsgi-1.0.2-py3-none-any.whl
| Download URL | naja_atra_wsgi-1.0.2-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9007497a8cb5979ddc9f3d0f60be628fc0c6b97e6d9debbe3859822cc5fa2758
|
|
BLAKE2b-256 checksum How to use checksums |
9b09ebaafa30c58de7dc28c291cdde19f6f4d079f85029abaa1ada8de0b33d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|