Serve a website through your dropbox
apache for your dropbox
A python server that uses the dropbox API to serve files that are hosted on dropbox. It will not be particularly useful to a developer who is comfortable with git, heroku, ftp, or another method of hosting a website. It will be useful, however, to people who don't know how to use these tools. It's very simple - whatever is in the Drapache folder in the users dropbox /Apps folder will be immediately available on the internet. Get it set up at get.drapache.com
Besides being able to serve static files, Drapache also implements a rudimentary CGI/PHP-like framework in python. Files that have the extension .dbpy or start with the string "#DBPYEXECUTE" will be treated as "dropbox python" files and executed by the Drapache server, returning anything that is printed to standard out to the clients browser.
Although far from finished, the dbpy framework is enough for beginning programmers to get started building dynamic websites. Check out blog.drapache (on github too) for a blogging system I scraped together that runs on drapache and demonstrates what can be done with dbpy.
It will create an index for a folder if one doesn't exist, using a template found in Drapache/_templates/. Files or folders that begin with '_' will not be served, returning instead a 403-Forbidden HTTP response. Right now they do show up in an auto-generated index, but that is for debugging purposes and could be easily changed
Working on documenting both the server as well as the dbpy framework.
This is the high level life-cycle of a request:
python get_dropbox_oauth.py [TESTING_SUBDOMAIN] >> [SUBDOMAIN_FILE](where TESTINGSUBDOMAIN is the subdomain you want to add to your local instance, and SUBDOMAINFILE is the name of the file in which you want to save subdomains)
python server.pyand you should have a drapache instance on localhost (the default port is 5501)
Notes: * add more testing subdomains by repeating step 4 for other subdomains * There are other ways of managing subdomains than a flat file.. look in subdomainmanager.py for the base class and an implementation of managing subdomains with mysql * This will create a folder in your dropbox /Apps folder with the name of whatever app you created in step 2, and your local instance will serve from that folder, _not the Drapache folder that you will get if you sign up through get.drapache
The tests test the functionality of the dbpy framework, which is sufficient for integration testing of the whole system. To use, create a symlink from the folder dbpy_test to wherever you are serving drapache file from, then go to test.html in that folder. It uses the QUnit testing framework.