Killer Web Development Walkthrough 1

1. Introduction

 I have somehow came across an awesome website called “Killer Web Development” (http://killer-web-development.com/). It is an online tutorial written by Marco Laspe, all about how to create real world web applications using web2py, an open source web development tool, and other stuffs related such as Python.

 He said, “The only prerequisites for this book are your enthusiasm and that you have basic knowledge how to use your computer.” Yes, I do! And I hope the enthusiasm will grow!🙂 The problems that I am having is the unfamiliarity with Linux OS and Python language. Even though I did a project on Android and Python last year, I could not recall how the interface looks like. Opps, this sounds ridiculous.

1.1 Introduction to web2py

Web2py is a rather new tool developed by Massimo Di Pierro in 2008. I tried it a few days ago when I was following another tutorial on creating a web application to control the lighting at home using R-Pi (http://www.instructables.com/id/Raspberry-Pi-GPIO-home-automation/). I will recall that on my blog when I have time. It was quite fun following though the steps in instructables.com and I learnt a lot!

Perhaps, lets start on the Killer Web Development! (mostly based on the tutorial and my own side notes)

1.2 Start your Engine

The first step was easy – get the web2py on your computer! (http://killer-web-development.com/section/1/3)

I did not follow the first few steps as I have gotten my web2py through this method:

  1. On R-Pi system, start the terminal and log in.

  2. sudo su

  3. wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
    chmod +x setup-web2py-ubuntu.sh

    ./setup-web2py-ubuntu.sh

***

sudo su – is to set the user mode to superuser whom is capable to do anything as the root user.

wget – which I observed, is to download something from the internet directly

chmod +x – is to grant execute access

./ – is to run a certain shell script?

During the installation, it is important to include the email and password, so that I can log into the server.

Then I could access web2py server at https://10.0.0.192 (my domain IP) , which will show a web2py default home index page. HTTPS is particularly important because the server is secured. I think there shouldn’t be a problem if download from the website manually (http://web2py.com/examples/default/download), unzip it and run it. The only thing to mind is the IP address (which I spent quite sometime to figure out for my R-Pi last week) and the port number. I am wondering why is it 8000 instead of 8080.

8000

UDP

iRDMI (Intel Remote Desktop Management Interface)[86]—sometimes erroneously used instead of port 8080

Official

8000

TCP

iRDMI (Intel Remote Desktop Management Interface)[86]—sometimes erroneously used instead of port 8080

Official

8000

TCP

Commonly used for internet radio streams such as those using SHOUTcast

Unofficial

8000

TCP

FreemakeVideoCapture service a part of Freemake Video Downloader [87]

Unofficial

8080

TCP

HTTP alternate (http_alt)—commonly used for Web proxy and caching server, or for running a Web server as a non-root user

Official

8080

TCP

Apache Tomcat

Unofficial

8080

UDP

FilePhile Master/Relay

Unofficial

 (source : wikipedia http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers)

Posted it as a question to Mr Laspe and wonder if he will reply :O .

Image

Next is to log into the Administrative Interface using my password. Here you could see some of the applications that I have created for the past few days. I just followed through the steps on the rest of the section.

Image

The interesting thing I learnt is the format of displaying the text.

return dict(message=T(‘Hello World. I\’m John. How are you?’))”

There is a complete Application Programming Interface (API) of web2py which can be found here: http://web2py.com/book/default/chapter/04#API

T” is the internationalization (i18n), which confused me for a while but after some readings, I somehow understand what it is for. It basically structures application in a way that makes it possible for them to localized. So cool!

So, “T” means “language translator”. Which if it contains message bundle for certain language, it is able to be translated. Awesome huh?

dict” means dictionary! Read more here (http://docs.python.org/2/tutorial/datastructures.html#dictionaries) but I do not quite understand.

Then it is almost the same as normal html editor, which I am not too familiar with. Also, “Notice the Backslash (\) behind the I – this is important because Python uses ticks to encapsulate Strings.” Then Ctrl+S to save.

(Hmm, I wonder what have I learnt in my study years! *rant rant*)

1.3 Deploying Your First App

Moving to next section – Deploying the web application. Yes, the word “deploy” confused me but all the answers are on Google.com

To install, test and implement a computer system or application” is the best answer I got from http://www.webopedia.com/TERM/D/deploy.html.

There are a few ways to deploy our web application which includes fluxflex.com ( I have not try it), Google’s App Engine, Pythonanywhere and etc (http://web2py.com/books/default/chapter/29/13).

It is my first time knowing Google’s App Engine, sounds cool. I should explore it when I am more advanced in this field.

So the tutorial guides us through how to deploy using http://pythonanywhere.com. I signed up for free account and got locked out once because I forgot the password (I think I mistyped it). I deleted the new application, log out, log in, and recreate a new application (choose web2py format and upload the w2p file). Then at http://yvonnezoe.pythonanywhere.com my website is online! Well it looks the same as https://10.0.0.192.com/first just that this is live and everyone could see it rather than just on my server. Awesome, I found another hosting!

1.4 Conclusion

Oh man! I found another interesting site called Diaspora! Check it out here: https://joindiaspora.com/. Perhaps with my little determination and some encouragement from all around the world (from you, reading this), I can be an older version of Mark Zuckerberg. Laugh. Okay, KIV but no Diaspora during working hour! (in fact, no blogging during working hour, but i’m treating this as a log book and not crapping!)

Okay, till next post!🙂

– Zoe –

3 comments

  1. Great post! I’ve just got my Raspberry PI and starting to learn some python as well. You’ve given some useful resources to help me get started. Hope to see more of your posts on raspberry pi and python.. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s