Skip to content
/ pyweb Public

A simple HTTP server written in Python 3.5+, requiring asyncio.

License

Notifications You must be signed in to change notification settings

gera2ld/pyweb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyweb

This is a super light web server based on asyncio (requires Python 3.5+).

Installation

$ 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:

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

About

A simple HTTP server written in Python 3.5+, requiring asyncio.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published