{
"info": {
"author": "Thane Thomson",
"author_email": "connect@thanethomson.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: POSIX",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Utilities"
],
"description": "httpwatcher\n===========\n\nOverview\n--------\n\n``httpwatcher`` is both a library and command-line utility for firing up\na simple HTTP server to serve static files from a specific root path.\nLive reloading is triggered via web sockets.\n\n**Note** that ``httpwatcher`` is intended for developers during testing\nof their static web sites, and is not at all intended as a production\nweb server.\n\nRequirements\n------------\n\nIn order to install ``httpwatcher``, you will need:\n\n- Python 2.7+ or Python 3.5+\n- ``pip`` or ``easy_install``\n\nInstallation\n------------\n\nWith your `virtual\nenvironment `__ active, run the\nfollowing:\n\n.. code:: bash\n\n > pip install httpwatcher\n\nTo upgrade to the latest version of ``httpwatcher``, simply:\n\n.. code:: bash\n\n > pip install -U httpwatcher\n\nUsage\n-----\n\n``httpwatcher`` can either be used from the command line, or as a\ndrop-in library within your own Python application.\n\nCommand-Line Usage\n~~~~~~~~~~~~~~~~~~\n\nThe quickest way to get up and running is to watch the current folder\nand serve your content from ``http://localhost:5555`` as follows:\n\n.. code:: bash\n\n # Also opens your web browser at http://localhost:5555\n > httpwatcher\n\n # To get more help\n > httpwatcher --help\n\nWith all possible options:\n\n.. code:: bash\n\n > httpwatcher --root /path/to/html \\ # static root from which to serve files\n --watch \"/path1,/path2\" \\ # comma-separated list of paths to watch (defaults to the static root)\n --host 127.0.0.1 \\ # bind to 127.0.0.1\n --port 5556 \\ # bind to port 5556\n --base-path /blog/ \\ # serve static content from http://127.0.0.1:5556/blog/\n --verbose \\ # enable verbose debug logging\n --no-browser # causes httpwatcher to not attempt to open your web browser automatically\n\nLibrary Usage\n~~~~~~~~~~~~~\n\nMake sure ``httpwatcher`` is installed as a dependency for your Python\nproject, and then:\n\n.. code:: python\n\n import httpwatcher\n\n # Just watch /path/to/html, and serve from that same path\n httpwatcher.watch(\"/path/to/html\")\n\n**Note** that, unlike ``HttpWatcherServer``, the ``httpwatcher.watch``\nfunction automatically assumes that you want to open your default web\nbrowser at the base URL of the served site. To avoid this, do the\nfollowing:\n\n.. code:: python\n\n import httpwatcher\n\n httpwatcher.watch(\"/path/to/html\", open_browser=False)\n\nTo use the watcher server directly and have more control over the I/O\nloop:\n\n.. code:: python\n\n from httpwatcher import HttpWatcherServer\n from tornado.ioloop import IOLoop\n\n def custom_callback():\n print(\"Web server reloading!\")\n\n server = HttpWatcherServer(\n \"/path/to/html\", # serve files from the folder /path/to/html\n watch_paths=[\"/path1\", \"/path2\"], # watch these paths for changes\n on_reload=custom_callback, # optionally specify a custom callback to be called just before the server reloads\n host=\"127.0.0.1\", # bind to host 127.0.0.1\n port=5556, # bind to port 5556\n server_base_path=\"/blog/\", # serve static content from http://127.0.0.1:5556/blog/\n watcher_interval=1.0, # maximum reload frequency (seconds)\n recursive=True, # watch for changes in /path/to/html recursively\n open_browser=True # automatically attempt to open a web browser (default: False for HttpWatcherServer)\n )\n server.listen()\n\n try:\n # will keep serving until someone hits Ctrl+C\n IOLoop.current().start()\n except KeyboardInterrupt:\n server.shutdown()\n\n``httpwatcher.watch`` takes mostly the same parameters as the\nconstructor parameters for ``HttpWatcherServer`` (except, as mentioned\nearlier, for the ``open_browser`` parameter). It's just a convenience\nmethod provided to instantiate and run a simple ``HttpWatcherServer``.\n\nInner Workings\n--------------\n\n``httpwatcher`` makes extensive use of the\n`Tornado `__ asynchronous web framework to\nfacilitate a combined asynchronous HTTP and WebSocket server. All HTML\ncontent served that contains a closing ``