Change name to fastwsgi

This commit is contained in:
James Roberts
2021-10-26 21:47:01 +02:00
parent f909c71693
commit 8f005693cf
15 changed files with 28 additions and 21 deletions

3
.gitignore vendored
View File

@@ -52,4 +52,5 @@ Mkfile.old
dkms.conf
.vscode
bin/
bin/
__pycache__/

View File

@@ -1,3 +1,3 @@
server: fast-wsgi/server.c
server: fastwsgi/server.c
mkdir -p bin
gcc -Illhttp/include llhttp/src/*.c fast-wsgi/request.c fast-wsgi/server.c fast-wsgi/constants.c -o bin/server -luv -I/usr/include/python3.8 -lpython3.8 -O3
gcc -Illhttp/include llhttp/src/*.c fastwsgi/request.c fastwsgi/server.c fastwsgi/constants.c -o bin/server -luv -I/usr/include/python3.8 -lpython3.8 -O3

View File

@@ -1,10 +1,10 @@
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/jamesroberts/fast-wsgi.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jamesroberts/fast-wsgi/context:cpp)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/jamesroberts/fast-wsgi.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jamesroberts/fast-wsgi/context:python)
# Fast WSGI
#### Note: Fast WSGI is still under development...
# FastWSGI
#### Note: FastWSGI is still under development...
Fast WSGI is an ultra fast WSGI server for Python 3.
FastWSGI is an ultra fast WSGI server for Python 3.
It is mostly written in C. It makes use of [libuv](https://github.com/libuv/libuv) and [llhttp](https://github.com/nodejs/llhttp) under the hood for blazing fast performance.
@@ -15,7 +15,7 @@ It is mostly written in C. It makes use of [libuv](https://github.com/libuv/libu
See [example.py](https://github.com/jamesroberts/fast-wsgi/blob/main/example.py) for more details.
```python
import fast_wsgi
import fastwsgi
from flask import Flask
app = Flask(__name__)
@@ -27,7 +27,7 @@ def hello_world():
if __name__ == "__main__":
fast_wsgi.run(wsgi_app=app, host="0.0.0.0", port=5000)
fastwsgi.run(wsgi_app=app, host="0.0.0.0", port=5000)
```
@@ -35,11 +35,11 @@ if __name__ == "__main__":
```python
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
start_response("200 OK", [("Content-Type", "text/html")])
return [b"Hello, World!"]
if __name__ == "__main__":
fast_wsgi.run(wsgi_app=application, host="0.0.0.0", port=5000)
fastwsgi.run(wsgi_app=application, host="0.0.0.0", port=5000)
```

View File

@@ -1,4 +1,4 @@
import fast_wsgi
import fastwsgi
from flask import Flask
app = Flask(__name__)
@@ -9,5 +9,10 @@ def hello_world():
return "Hello, World!", 200
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [b"Hello, World!"]
if __name__ == "__main__":
fast_wsgi.run(wsgi_app=app, host="0.0.0.0", port=5000)
fastwsgi.run(wsgi_app=application, host="0.0.0.0", port=5000)

View File

@@ -1,6 +1,6 @@
import os
import signal
import _fast_wsgi
import _fastwsgi
NUM_WORKERS = 4
@@ -19,7 +19,7 @@ def run_multi_process_server(app):
print(f"Worker process added with PID: {pid}")
else:
try:
_fast_wsgi.run_server(app, HOST, PORT, BACKLOG, 0)
_fastwsgi.run_server(app, HOST, PORT, BACKLOG, 0)
except KeyboardInterrupt:
exit()
@@ -35,5 +35,5 @@ def run_multi_process_server(app):
def run(wsgi_app, host, port, backlog=1024):
print("Starting server...")
enable_logging = 0
_fast_wsgi.run_server(wsgi_app, host, port, backlog, enable_logging)
_fastwsgi.run_server(wsgi_app, host, port, backlog, enable_logging)
# run_multi_process_server(app)

View File

@@ -8,12 +8,12 @@ static PyMethodDef FastWsgiFunctions[] = {
static struct PyModuleDef module = {
PyModuleDef_HEAD_INIT,
"fast_wsgi",
"fast_wsgi Python module",
"fastwsgi",
"fastwsgi Python module",
-1,
FastWsgiFunctions,
};
PyMODINIT_FUNC PyInit__fast_wsgi(void) {
PyMODINIT_FUNC PyInit__fastwsgi(void) {
return PyModule_Create(&module);
}

View File

@@ -19,6 +19,7 @@ void close_cb(uv_handle_t* handle) {
free(handle);
}
void write_cb(uv_write_t* req, int status) {
if (status) {
fprintf(stderr, "Write error %s\n", uv_strerror(status));

View File

@@ -2,10 +2,10 @@ import glob
from distutils.core import Extension, setup
SOURCE_FILES = glob.glob("fast-wsgi/*.c") + glob.glob("llhttp/src/*.c")
SOURCE_FILES = glob.glob("fastwsgi/*.c") + glob.glob("llhttp/src/*.c")
module = Extension(
"_fast_wsgi",
"_fastwsgi",
sources=SOURCE_FILES,
libraries=['uv'],
include_dirs=["llhttp/include"],
@@ -13,7 +13,7 @@ module = Extension(
)
setup(
name="fast_wsgi",
name="fastwsgi",
version="0.1",
description="An ultra fast WSGI server for Python 3",
ext_modules=[module]