mirror of
https://github.com/jamesroberts/fastwsgi.git
synced 2026-04-30 08:29:30 -05:00
882fe7972fec952f229baa2720ff57fb15447d5d
* Add support log subsystem * Replace logger calls to LOGi (LL_INFO) * Add new global object: server_t g_srv * Make current_header as static char array * Make global struct g_cv which contain static Py strings * Add new const values to global struct g_cv * Add loglevel option to fastwsgi.py * Fix bug then response body contain 0x00 symbol * Add new header file: common.h * Replace response buffer type to xbuf_t (new expanded buffer) * Cleanup function build_response (remove waste alloc mem) * Add extended logging into server.c * Update submodule llhttp to 8.1.0 release * Add functions build_response_ex and send_fatal * Fix send error message then use Keep-Alive connection * Fix call uv__socket_sockopt (first arg incorrect)
FastWSGI
🚧 FastWSGI is still under development.
FastWSGI is an ultra fast WSGI server for Python 3.
Its written in C and uses libuv and llhttp under the hood for blazing fast performance.
Supported Platforms
| Platform | Linux | MacOs | Windows |
|---|---|---|---|
| Support | ✅ | ✅ | ✅ |
Performance
FastWSGI is one of the fastest general use WSGI servers out there!
For a comparison against other popular WSGI servers, see PERFORMANCE.md
Installation
Install using the pip package manager.
pip install fastwsgi
Quick start
Create a new file example.py with the following:
import fastwsgi
def app(environ, start_response):
headers = [('Content-Type', 'text/plain')]
start_response('200 OK', headers)
return [b'Hello, World!']
if __name__ == '__main__':
fastwsgi.run(wsgi_app=app, host='0.0.0.0', port=5000)
Run the server using:
python3 example.py
Or, by using the fastwsgi command:
fastwsgi example:app
Example usage with Flask
See example.py for more details.
import fastwsgi
from flask import Flask
app = Flask(__name__)
@app.get('/')
def hello_world():
return 'Hello, World!', 200
if __name__ == '__main__':
fastwsgi.run(wsgi_app=app, host='127.0.0.1', port=5000)
Testing
To run the test suite using pytest, run the following command:
python3 -m pytest
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests where appropriate.
TODO
- Comprehensive error handling
- Complete HTTP/1.1 compliance
- Unit tests running in CI workflow
Description
Languages
C
78.5%
Python
18.7%
Shell
2.4%
Makefile
0.3%
Batchfile
0.1%
