Linux Debian

Killer Web Development Walkthrough Part 4 continue

This continues from Killer Web Development Walkthrough Part 4

Skipped the Selenium part, moving on to “Fix our first test”. I couldn’t perform hg add fts/*. it gave me such error:

abort: /bin not under root

Leave it for the time being.

And i just found out one serious problem. In my zapp folder, there is only the .hg and fts folder. the necessary files are not there! so i perform
./ -S zapp again and it returns me the following:

OSError: [Errno 2] No such file or directory: ‘applications/zapp/language’

but the is there! in the /web2py/gluon

since i can’t create any new applications for now, (perhaps due to the changing of ownership yesterday argh), i shall copy the pitch application and rename it as zapptest and edit from there.

Start from installing selenium again. blah blah blah and FAILED.

In the end, i decided to change the ownership back to root. lesson learnt, not everyone replied to your forum questions can solve your problem!

sudo chown root:pi /home/www-data/web2py

okay, ownership changed and now i can create a new app!

sudo ./ -S zap

and there i go, repeating the same procedure from the start, just that now everything has to be in sudo mode. weird.

i copied the hgrc file from pitch too.

well after going through the whole process again, hoping for this miracle moment, it still gives the same error…

ERROR:Rocket.Errors.Port8001:Socket “ in use by other process and it won’t share.
WARNING:Rocket.Errors.Port8001:Listener started when not ready.

All right, moving on to “Fix ur first test”
$ gedit views/default/index.html

can’t perform the test.

With that i concluded section 4, with failures. sigh. I wonder if i should continue from here? 3 more chapters to go. next chapter will be mostly about testing the app!

Mozilla Firefox on Linux Debian?

Previously, i was following through a tutorial at Killer Web Development and i encountered a problem while trying to use Selenium… because I only have Iceweasel and not Firefox. So, here’re my experiences in finding the answer: Will update when i try something new! :s

1. Well, thank goodness i found an answer for my Firefox and Iceweasel problem here.

First, you need to remove the existing Iceweasel package

apt-get remove iceweasel

To use Linux Mint’s Debian package repo, add the following line to your /etc/apt/sources.list file:

cd /etc/apt
nano sources.list

add the following line:

deb debian import

Then, just run:

apt-get update
apt-get install firefox-l10n-en-us

E: unable to locate package firefox-l10n-en-us

Err debian/import armhf Packages
404 Not Found


2. Same goes for this:
apt-get remove iceweasel
echo -e "\ndeb all main" | tee -a /etc/apt/sources.list > /dev/null
apt-key adv --recv-keys --keyserver C1289A29
apt-get update
apt-get install firefox-mozilla-build

3. I tried to download the latest Firefox onto my Raspberry Pi, but the

download just won’t start on Midori. Hmm, has been unable to download

since days ago i guess.
Nevertheless, i downloaded firefox for linux from here
and transfer the files to R-Pi using Core FTP LE.

Then, i followed the instructions in another reply under the same forum thread, and tried to copy the downloaded file to /opt

$ cp firefox /opt

cp: omitting directory
The command cp is by default copies only files and if we try to copy a

directory it will throw the above error.

To copy a directory using “cp” all we have to do is add the option “-r”

which means recursively copy all the files from the source directory to the

destination directory. i.e.

cp -r dir1 dir2

Anyway, i still have the bz2 file so,

sudo cp firefox-19.0.tar.bz2 /opt

(without sudo, permission denied)

And yes, copied successfully.

Extract it using:

$ cd /opt
$ sudo tar -jxvf firefox-19.0.tar.bz2

Change the permissions of the file:

$ chown -R root:users /opt/firefox # OPERATION NOT PERMITTED

$ chmod 750 /opt/firefox

Note that the user should be a group member of “users”

$ usermod -a -G users username

Create a symbolic link

$ ln -s /opt/firefox/firefox /usr/bin/firefox

Delete firefox-19.0.tar.bz2 from /opt
cd /opt
sudo rm firefox-19.0.tar.bz2

Conclusion: stuck at unable to change owner. but i doubt it is already under the root ownership. However, i still cannot run the some errors to do with selenium still. Anyway, i am going to skip the step for the mean time.

Some useful reference:

To copy files, you use the cp command. The following will copy file to file2. Note that if file2 doesn’t exist, it’ll be created, but if it exists, it’ll be overwritten:
$ cp file file2

There aren’t any undo commands in the Linux CLI, so accidentally overwriting an important file would probably make you pull your head off. The risk of doing so is smaller if you use the -i option (“interactive”) with cp. The following does the same as the above, but if file2 exists, you’ll be prompted before overwriting:

$ cp -i file file2
cp: overwrite `file2'? n

So it’s a good idea to use the -i option whenever you’re dealing with important files you don’t want to lose!

If you want to copy file into directory dir1:
$ cp file dir1

The following would do the same as the above, copy file into dir1, but under a different name:
$ cp file dir1/file2

You can also copy multiple files into one directory with a single command:
$ cp file1 file2 file3 dir1

Note that if the last argument isn’t a directory name, you’ll get an error message complaining about it.

The mv command can be used for moving or renaming files. To rename a file, you can use it like this:
$ mv file file2

If file2 doesn’t exist, it’ll be created, but if it exists, it’ll be overwritten. If you want to be prompted before overwriting files, you can use the -i option the same way as with cp:

$ mv -i file file2
mv: overwrite `file2'? y

To move the file into another directory:
$ mv file dir1

If you want to rename the file to file2 and move it into another directory, you probably already figured out the command:
$ mv file dir1/file2

The rm command is used for removing files and directories. To remove a file:
$ rm file

If you use the -i option, you’ll be prompted before removing the file:
$ rm -i file

You can also delete more files at once:
rm file1 file2

Be careful with the rm command! As I already told you, Linux doesn’t have any undo commands, and it doesn’t put files into Trash where you can save them later. Once you’ve deleted a file, it’s bye-bye!

Killer Web Development Walkthrough 1

1. Introduction

 I have somehow came across an awesome website called “Killer Web Development” ( 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 ( I will recall that on my blog when I have time. It was quite fun following though the steps in 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! (

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
    chmod +x



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 (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 (, 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.



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




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




Commonly used for internet radio streams such as those using SHOUTcast




FreemakeVideoCapture service a part of Freemake Video Downloader [87]




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




Apache Tomcat




FilePhile Master/Relay


 (source : wikipedia

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


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.


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:

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 ( 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

To install, test and implement a computer system or application” is the best answer I got from

There are a few ways to deploy our web application which includes ( I have not try it), Google’s App Engine, Pythonanywhere and etc (

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 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 my website is online! Well it looks the same as 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: 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 –