Skip to main content

webz

简单的web服务器框架,实现的是配置文件的读取和调用,内部调用web.py

注:代码实现了url映射和查找,查找方式是for循环遍历列表,url映射配置多了的话循环显然不是好方法,相关代码在
configz.ConfigWeb.deal和config.ConfigWeb.deal
可以自行修改

demo在demo文件夹中,两种配置方式,分别运行:
python run.py
python runz.py
推荐runz.py的配置方式

为了本人自己使用方便以及利用浏览器缓存减少http请求,把bootstrap、jquery.js和vue.js放进文件夹了,可以不使用或者替换掉,另外有两脚本文件base.js和utils.js,分装了一些方法:
    json调用:
    $.json(url, data, success=(rst)=>{}, error=(rst)=>{})
    $.upload(...)
    $.submit(...) //这个没测试
    $.get(url, success=(rst)=>{}, error=(rst)=>{})
    页面跳转(带数据)
        _.jump(url, data)
    新页面通过以下方法获取数据:
        _.data()
    页面回跳(和左上角后退键一个功能,不过可以加回跳参数):
        _.back(backData=null)
    原页面还是通过_.data()获取初始化时的原数据,也可以通过_.backData()获取回跳时设置的数据

    通过js代码引入js文件库:
        addScript(url)
    通过js代码引入css文件库:
        addStyle(url)

    vue相关:
    组件:
    component(url, id=null)
    实际是把url对应的页面嵌入当前页面

    页面vue创建:
    newVue({
        data(){return {...}},
        mounted(){...},
        methods:{...}
    })

    相关使用参考demo/test1.html

    要使用这个工具类,需要把/webz/js映射成webz.js,并在页面引入脚本:
        <script src="/webz/js/base.js"></script>
        <script src="/webz/js/packs.js"></script>
    或者
        <script src="/webz/js/base.js"></script>
        <script src="jquery路径"></script>
        <script src="vue路径"></script>
        <script src="/webz/js/utiils.js"></script>

任意一个运行后,尝试访问网址:
http://127.0.0.1:8080/page/test1.html
http://127.0.0.1:8080/func/abc?d=e&f=g

Metadata

Release files for webz 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webz 0.0.9
File Size Uploaded Provenance Actions
webz-0.0.9.tar.gz 137.7 kB Without provenance Details for webz-0.0.9.tar.gz

Release files / webz-0.0.9.tar.gz

Download URL webz-0.0.9.tar.gz
Size 137.7 kB
Tags Source
SHA-256 checksum
How to use checksums
35d18a151fe9f911c305d94952d3d75e9e84b418abe15eb5e1d975c22f6bd23b
BLAKE2b-256 checksum
How to use checksums
a98355b044d3c763bd0825bf11c6e675c43144b58fabb4d92e61521f1199c65d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.10

Security for webz 0.0.9

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page