https://github.com/gera2ld/pyweb
A simple HTTP server written in Python 3.5+, requiring asyncio.
https://github.com/gera2ld/pyweb
Last synced: about 2 months ago
JSON representation
A simple HTTP server written in Python 3.5+, requiring asyncio.
- Host: GitHub
- URL: https://github.com/gera2ld/pyweb
- Owner: gera2ld
- License: mit
- Created: 2014-12-24T06:04:11.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-01-15T06:36:57.000Z (over 6 years ago)
- Last Synced: 2025-01-15T05:52:53.149Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 112 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pyweb
===
This is a super light web server based on `asyncio` (requires Python 3.5+).
Installation
---
``` sh
$ pip3 install git+https://github.com/gera2ld/pyweb.git
```
Usage
---
CLI usage:
```
Usage: pyweb [OPTIONS]
Start a web server with pyweb.
Options:
-b, --bind TEXT the address to bind, default as `:4000`
-r, --root TEXT the root directory of documents
--help Show this message and exit.
```
Programmatic usage:
``` python
from pyweb.server import HTTPDaemon
# Options are optional
server = HTTPDaemon({
'host': '',
'port': 80,
'match': None,
'handler': [
{
'handler': 'fcgi',
'options': {
'fcgi_ext': '.php',
'fcgi_target': ['127.0.0.1:9000'],
'index': [
'index.php',
],
},
},
'file',
'dir',
],
'gzip': [
'text/html',
'text/css',
'application/javascript',
],
'options': {
'root': '.',
'index': [
'index.html',
],
},
})
server.serve()
```