Developing with Bottle - part 1 - June 17, 2013

I love bottle . It's a simple, yet fast and powerful Python micro-framework, perfect for small web applications and rapid prototyping. It's also a perfect learning tool for those just getting starting with web development.

Let's look at a quick example.

This tutorial assumes you are running a Unix-based environment - e.g, Mac OSX, straight Linux, or Linux VM through Windows. I will also be using Sublime 2 as my text editor.

Starting up

First, let's create a directory to work in:

$ mkdir bottle
$ cd bottle

Next, you need to have pip, virtualenv, and git installed.

virtualenv is a Python tool that makes it easy to manage the Python modules needed for a particular project. It also keeps modules from conflicting with other projects. pip , meanwhile, is a package manager used for managing the installation of libraries and modules.

For help with installing pip (and it's dependencies) in a Unix environment, follow the instructions in this Gist . If you are on Windows, please view this video for help.

Once you have pip installed, run the following command to install virtualenv:

$ pip install virtualenv

Now we can easily setup our local environment by running:

$ virtualenv --no-site-packages testenv
$ source testenv/bin/activate
Writing Python FR for the Web - start to finish - May 13, 2013

Self-publishing an ebook/course is much more than just opening Microsoft Word and writing.

You're building a product for the web - this is a complicated process. It involves the traditional development of a business model, designing a landing page, and marketing and engaging with users. And, don't forget, you still need to WRITE!

Here are the basic steps I took:

  1. Find something to write about.
  2. Determine if that something is also in demand - e.g., do people want it and will they pay for it.
  3. Develop your business model.
  4. Engage, iterate, refine, and write .
  5. Market, share, refine, and write
  6. Build a landing page. Write
  7. Market. Write
  8. Write.


Before I even began writing, I did my market research. I had a topic in mind and thought there was demand for it. In those early days, I needed to test my hypothesis to see if there really was demand.

I used a number of tactics to address these issues. First, I conducted a basic competitor analysis. To my surprise there were not any single resources for using Python for web development. There are a number of resources on using specific Python-based web frameworks. However, I wanted to write about the complete process from start to finish. The main competitors were actually Ruby-versions of the same thing. While Ruby is designed mainly for web development (and used by all the "cool" kids), I felt Python is much more practical language to learn - and just as well-suited for web development. The syntax is easier to learn, there are a number of applicable uses, and there's a plethora of web frameworks.

At that point, I knew I had something, but I still needed to be sure there was plenty of demand before devoting 6+ months writing.

I spent another month just talking with people. Detailing my ideas, objectively, without selling them, to get honest feedback. I probably talked to over fifty people within both the Python and web development communities. After receiving a significant amount of positive feedback, the backing from a major web framework, and a business partner, I took my model to the testing phases using KickStarter.

KickStarter is an excellent means of testing out a business model. There's much to be said on the topic, which you can read about here .


Build your own website: Python vs. Ruby - Feb 2, 2013

Why pay someone else to build your website? You know what you want, so don't waste the time and money it takes to get someone else to understand what you want. Sure they could do it faster, but is that worth giving up all that control? And what happens when something goes wrong? Are you going to call someone every time you need to update it?

Coding is a tremendously powerful skill to develop. If you are already a coder, you know learning a new web development language will make you more valuable as the world becomes more web-enabled. The Internet of Things Initiative is working hard to bring the whole planet online, from appliances to cars to soil, with sensors and networking. Learning Python or Ruby can be your first step into an entirely new life and may become absolutely necessary for your business to survive.

Python and Ruby were released in the early 1990s, around the time the web was born. In fact, Ruby was built using some of the design elements from Python. They weren't made specifically for web development, but these two languages became extremely popular after they were used to create some of the biggest destinations on the web. Rails is the open source full-stack framework that simplifies building web platforms with the underlying Ruby language. Ruby on Rails was used to create huge sites like Twitter and Hulu. Python racked up a lot of publicity by being the number one choice of Google and YouTube. Udemy produced a great infographic summing up this war of the web-building titans of Python vs. Ruby .

Too Much Ruby

If you took a look at that infographic you can see a few things stand out. First of all, Python gets the best possible score for Ease of Learning. Even though there are twice as many Python developers as Ruby developers, there were slightly more Ruby jobs posted on Monster when the data was collected at the end of 2011. It could be that people are learning Python for their own websites and Ruby developers are becoming harder to find.

Although Python has been around longer, there are many more Ruby on Rails bootcamps, tutorials, etc. online and ITRW (“in the real world” aka meatspace as opposed to cyberspace). It's also clear that there is just not enough focus on Python. This may be because Python seems so much easier to teach yourself but not everyone learns that way.

Why Python Is Better

There's no question that both Ruby on Rails and Python, using a web application framework like web2py or Django, are equally great at building websites. What makes Python better is that its ease of use allows beginners to start building powerful sites more quickly. Python certainly has the power to grow with you in complexity as you become a better programmer, but ease of comprehension will continue to serve you in several ways. For example, one of the hardest parts of coding is going back to what you coded long ago and trying to remember the logic of it. Because Python uses natural language with white spaces and indenting, it is much more clear and easier to read than languages like Ruby. That alone makes it easier to fix mistakes or do updates. Also, there are literally thousands of pre-built modules that can be snapped on to let you get up and running on the web immediately. Its intuitive introduction to object-oriented coding concepts, such as communities, modules, and libraries, allows you to move on to other related programming languages as they develop. Best of all, Python broke into the top five most popular programming languages this month , up 10 percent over the last year. Ruby is sitting comfortably in 9th place, with just 3 percent growth after a decline last year. That means there will be a lot more Python-based web applications on the way.

Kickstarting Python FR for Web Development

Enough talk, let's do something about it. Specifically, I'm doing my part to help people get started with Python by building my own online e-course. Stop by my Python course Kickstarter page for all the details. I am developing an ebook, complete with exercises and code samples, as well as a video series for people new to Python Web Development. The main goal is for beginners to gain the basic knowledge on how to setup a development environment quickly so you can start building web applications. You will learn through a series of exercises, which are challenging enough that you will have to write code on your own. You will screw up. But you will learn from your mistakes. And you will get better.

The ideal reader has some background in a programming language, but beginners are welcome. If you are completely new to Python, you should consider the $25 pledge to get the introductory Python FR course as well as the new web development course; this will give you all the resources you need to go from complete beginner to web development guru!