Bookworm-project / BookwormDB

Tools for text tokenization and encoding
MIT License
84 stars 12 forks source link

implement `bookworm serve` for website without apache #70

Closed bmschmidt closed 9 years ago

bmschmidt commented 9 years ago

Working with a grad student, it seems like maybe the headaches related to Apache installations could be alleviated for first-draft installations by using a python server instead.

I can confirm that in a running bookworm directory, this gist works to fully clone the linechart browser and get it running on OS X 10.9 and Ubuntu 14.04 when other things are installed, without requiring an Apache server.

(running inside a clone of this repository after setting up the database)

mkdir GUI
make linechartGUI webDirectory=GUI
git clone git@github.com:Bookworm-Project/BookwormAPI GUI/cgi-bin
cd GUI; python -m CGIHTTPServer 8000

Visit http://localhost:8000, and click to navigate to whatever the bookworm name is.

I don't know what user it's querying the database under--presumably the administrator, though. That means it's

  1. Way easier to set up--the apache user and apache config seems to be far and away the hardest part
  2. Less secure (ie, maybe a creatively malicious person could use a proper combination of escapes and semicolons to slip a "DROP DATABASE" statement through.)
bmschmidt commented 9 years ago

Changing the title: bookworm serve under the module/argparse architecture would be a clean way to spin up a local webhost in a subdirectory using python CGIHTTPServer.

Probably use either 8004 or 8003 as the port because they look, to me, like the word "book."

bmschmidt commented 9 years ago

Implemented at https://github.com/Bookworm-project/BookwormDB/commit/37d7599c6d11d1212ac2edf9286f95e4d0258e3e