Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (55 sloc) 2.07 KB
Bottlecap is a tiny static HTTP server.
I built it on Bottle <http://bottle.paws.de/docs/dev/index.html>
Requirements:
bottle
Required to follow this file directly:
virtualenvwrapper
pip
###############
### INSTALL ###
###############
## Make a virtualenv to serve as a toggle for bottlecap usage
$ mkvirtualenv bottlecap
## Install bottlecap
$ pip install https://github.com/sshirokov/bottlecap/tarball/master
##############
#### USE #####
##############
## Activate the bottlecap virtualenv
$ workon bottlecap
## Go to where you want to serve data
$ cd ~/src/my-project
## Run bottlecap
$ bottlecap
## Go to http://localhost:6969
$ open http://localhost:6969 # OS X example
## When you're done with that directory kill bottlecap with Control-C
$ bottlecap
Bottle server starting [..]
Listening on [..]
Use Ctrl-C to quit.
^C
Shutting down...
$
## When you no longer wish to have bottlecap on your path, deactivate the virtualenv
$ deactivate
##############
### NOTES ####
##############
## Like, tips and tricks?
=> 'bottlecap -h' Will display command-line help
=> Instead of changing to a directory and running bottlecap you can tell
bottlecap where to serve from with the -m PATH/--media=PATH options.
=> The server will by default reload the content when it notices changes,
and dump full stack traces back at the browser when you inevitably run
across an awesome bug.
=> The tutorial above is the absolute quickest point A -> B walkthrough to get you started,
system-wide installation is still an option, thogh I usually regard it as one for crazy people.
=> The index file selection code right now looks for files named roughly 'index.something', prioritizing
based on longest match (and as a result, preferring /index.htm.?/) when you hit a url that resolves
to a directory. I might add more later, but so might you, the whole project is under 100 lines of codes.
That's pretty much it.
The code isn't awesome because I hacked it together pretty quick for fun.
If there's ever any interest, I'll clean it up and evolve the "idea."
Have Fun!
-Slava