naja-atra-wsgi


Namenaja-atra-wsgi JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryThis is a simple http server, use MVC like design.
upload_time2024-04-11 03:16:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2018 Keijack Wu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords http-server websocket http web web-server
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Naja Atra WSGI

This ia a WSGI proxy that proxies requests to Naja Atra.

# Usage

```python
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.

```python
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()
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "naja-atra-wsgi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "http-server, websocket, http, web, web-server",
    "author": null,
    "author_email": "keijack <keijack.wu@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/23/bf/ce1625a13b55e04a274bc1ac876d0a78c5e8a6f6b5e9a2ad7abdd548b110/naja-atra-wsgi-1.0.1.tar.gz",
    "platform": null,
    "description": "# Naja Atra WSGI\n\nThis ia a WSGI proxy that proxies requests to Naja Atra.\n\n# Usage\n\n```python\nfrom naja_atra import route\nfrom naja_atra_wsgi import app\nfrom wsgiref.simple_server import make_server\n\n@route(\"/hello\")\ndef hello(name: str):\n    return {\"messag\": f\"Hello, {name}!\"}\n\nif __name__ == '__main__':\n    server = make_server('0.0.0.0', 8080, app)\n    server.serve_forever()\n\n```\n\nYou 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.\n\n```python\nimport os\nimport naja_atra.server as server\n\nfrom wsgiref.simple_server import make_server\nfrom naja_atra_wsgi import config, app\n\nPROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))\n\nif __name__ == '__main__':\n    \n    server.scan(base_dir=\"tests/ctrls\", regx=r'.*controllers.*')\n    config(resources={\"/public/*\": f\"{PROJECT_ROOT}/tests/static\",\n                    \"/*\": f\"{PROJECT_ROOT}/tests/static\"})\n\n    wsgi_server = make_server(\"\", 9090, app)\n    wsgi_server.serve_forever()\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2018 Keijack Wu  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "This is a simple http server, use MVC like design.",
    "version": "1.0.1",
    "project_urls": {
        "homepage": "https://github.com/naja-atra/naja-atra-wsgi",
        "repository": "https://github.com/naja-atra/naja-atra-wsgi"
    },
    "split_keywords": [
        "http-server",
        " websocket",
        " http",
        " web",
        " web-server"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "97411b25a75e8c277fbe9668db60c78ca1822a1ce9b8dfb6bf4dc2b755bb2ef7",
                "md5": "74b2a579414fae5fabcfb035e040dc87",
                "sha256": "5746a2edbb2996a45170312517962c4b9d3cc5b286c28e511818825848c675b4"
            },
            "downloads": -1,
            "filename": "naja_atra_wsgi-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74b2a579414fae5fabcfb035e040dc87",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6985,
            "upload_time": "2024-04-11T03:16:34",
            "upload_time_iso_8601": "2024-04-11T03:16:34.005001Z",
            "url": "https://files.pythonhosted.org/packages/97/41/1b25a75e8c277fbe9668db60c78ca1822a1ce9b8dfb6bf4dc2b755bb2ef7/naja_atra_wsgi-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23bfce1625a13b55e04a274bc1ac876d0a78c5e8a6f6b5e9a2ad7abdd548b110",
                "md5": "596a26453544f85871ca2087179e7040",
                "sha256": "266fb04acf37861857e93c1c2abc836b65d9884c2ea7d7ca7a9000eafe64a158"
            },
            "downloads": -1,
            "filename": "naja-atra-wsgi-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "596a26453544f85871ca2087179e7040",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6746,
            "upload_time": "2024-04-11T03:16:38",
            "upload_time_iso_8601": "2024-04-11T03:16:38.351401Z",
            "url": "https://files.pythonhosted.org/packages/23/bf/ce1625a13b55e04a274bc1ac876d0a78c5e8a6f6b5e9a2ad7abdd548b110/naja-atra-wsgi-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-11 03:16:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "naja-atra",
    "github_project": "naja-atra-wsgi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "naja-atra-wsgi"
}
        
Elapsed time: 0.24224s