Giter Club home page Giter Club logo

bottlecap's Introduction

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

bottlecap's People

Contributors

sshirokov avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.