Dynamic Web Application (DWA)
Dynamic Web Application (DWA) framework written with Tornado.
Hierarchy
dwa
Example
python
./pages/init.py
from . import root
from . import common
./pages/common.py
from dwa import *
class static_file_page(handlers.StaticFileHandler):
def validate_absolute_path(self, root, absolute_path):
return super().validate_absolute_path(root, absolute_path)
def set_extra_headers(self, path):
self.set_header('Cache-Control', 'must-revalidate, max-age=0')
./pages/root.py
from dwa import *
from . import common
server_name = "root"
class root_html(handlers.HTML):
server = server_name
class index_page(root_html):
file_name = "index"
def get_root_settings(app_root):
app_root = os.path.join(app_root, server_name)
return (
server_name,
[
(r"/", index_page),
(r"/((?:img|js|css|common)/.*)", common.static_file_page, {"path": app_root}),
]
)
./app.py
from dwa import *
import pages
def app_settings_template(app_root: str, domain: str, port: int, cookies_expires_day: float) -> dict:
settings = {}
db = "db/db.db"
settings["cookie_secret"] = open(os.path.join(app_root, "cookie_secret.txt"), "rb").read()
settings["port"] = port
settings["db"] = db
settings["domain"] = domain
settings["cookies_expires_day"] = cookies_expires_day
servers = [
pages.root.get_root_settings(app_root),
]
settings["servers"] = {k: v for k, v in servers}
return settings
def app_settings(app_root: str) -> dict:
return app_settings_template(app_root, "your.domain.com", 8888, 1)
./test.py
import dwa
Metadata
Release files for dwa 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dwa-0.0.3.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dwa-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.1 kB
Release files / dwa-0.0.3.tar.gz
| Download URL | dwa-0.0.3.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0e101e46f062bfe53d77792396e792d4ac9c468c8800f71e8a6fdac6570935b
|
|
BLAKE2b-256 checksum How to use checksums |
b2a9312eba6105edce5e4ddf87afc8b01ae14c74fc42f7a2ef89fe30c35117c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0
|
Release files / dwa-0.0.3-py3-none-any.whl
| Download URL | dwa-0.0.3-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7184d5a72a51073574e7743f1c9ee442e2a7ebcf9093cc0c762b3c0d8c15240b
|
|
BLAKE2b-256 checksum How to use checksums |
35d428efaba9454a2d0d01305b8d9238559fb7c2a4bb7c28903a51445031f0d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.0
|