Richard Bucker

Bootstrapping your next project with Bootstrap.

Posted at — Jan 18, 2012

Bootstrap is a nice little web app starter framework released by the kind folks at Twitter. I’m not sure why they did it but I suppose that does not matter much. It’s nice, open, and fun.For the purpose of this bootstrap project, which I’m calling freestrap, I’m going to select some technology that I previously installed in a recent article. The stack will be: python tornadoweb or maybe flask beanstalkd bootstrap and it’s deps modern-package-template mustacheI was going to implement a database layer too but I think that will be postponed until the next project is fully realized. At this point everything is already installed. You need to navigate to your project directory.  I like to create a git or hg folder immediately in my home. cd ${HOME} mkdir -p hg then you’ll need to create the project folder (‘freestrap’) with the modern packager. cd ${HOME}/hg paster create -t modern_package freestrap And you can run the application by typingfreestrap if you execute the ‘tree’ command you should see something like this.(currentenv)rbucker@soldev:~/hg/flafreeit/freestrap$ tree.├──├── buildout.cfg├── HACKING.txt├──├── NEWS.txt├── README.rst├──└── src ├── freestrap │   └── └── freestrap.egg-info ├── dependency_links.txt ├── entry_points.txt ├── not-zip-safe ├── PKG-INFO ├── SOURCES.txt └── top_level.txt3 directories, 14 filesThat’s it for the bulk installation. Now I’ll integrate flask, mustache and bootstrap. create src/freestrap/ with the following code.from flask import Flaskapp = Flask(name)@app.route("/")def hello(): return “Hello World!"def main(): update src/freestrap/ to look like this# Example package with a console entry pointfrom freestrap import hellodef main(): hello.main()now install the package and rerun the app: python ./ install freestrapYou’ll see that the web server is running on If you’re like, however, you won’t be able to load the test page because it’s a remote server that needs to connect to So change the last line in to:‘’, port=5000,)and with the next restart you’ll be able to point your browser to this app. Of course you always tunnel.ssh -L 5000:localhost:5000 rbucker@myhost.remote.comand then put http://localhost:5000