The main requirements for this course are:
If you aren't familiar with the command-line, programming text editors, UNIX, and/or don't have a good comfort level with basic usage of Python/Git already, then you can take the "beginner track" in this course.
Rather than setting up your local computer, you will simply follow along what I'm doing on the screen, and optionally connect to a server I have set up where you can experiment with an IPython Notebook and CodeMirror HTML Editor.
You can download the code to follow along:
You'll likely have the pre-reqs, but let's make sure you have some good versions. Open a terminal.
python -V and make sure you're on Python 2.7.x.
git --version to make sure you have git 1.7/1.8 installed.
A recent Python version (2.7.3) can be installed from http://python.org.
A recent Git version (1.8.1) can be downloaded from http://git-scm.com.
This course assumes you can walk around the command line a bit.
A quick cheat sheet:
ls: list files in current directory
pwd: print working directory path
cd <path>: change directory
mkdir <path>: create a directory
cat <file>: show contents of file
nano <file>: open file in nano text editor
Make a work area::
Clone the code respository::
git clone git://github.com/amontalenti/rapid-web.git cd rapid-web
Inspect the tags::
git tag -l
Look at Github web interface:
Feel free to fork!
All the changes from the initial check-in to the last on Github.
easy_install command may not be available in some borked Python versions on
Linux and OS X.
easy_install --version to check.
If not available, use this script::
curl -O http://python-distribute.org/distribute_setup.py python distribute_setup.py
Run this virtualenv setup::
$ sudo easy_install pip $ sudo pip install virtualenv
$ cd rapid-web $ virtualenv rapid-env
This will create a self-contained Python installation for use with this tutorial.
One of the first Python development tools I'll use in hour 2 is IPython.
It lets us test code at the command-line easily.
You should now have a virtualenv folder called
rapid-env. For convenience,
let's make it easy to activate::
$ ln -s rapid-env/bin/activate
Activate it with the "magic incantation"::
$ source activate
And then, install IPython::
(rapid-env)$ pip install ipython ... lots of output ... (rapid-env)$ ipython -V 0.13.1
$ cat requirements.txt ipython Flask $ pip install -r requirements.txt ...
Then, confirm that you can import all the libraries.
$ ipython >>> import flask >>> import jinja2 >>> import werkzeug >>> <CTRL+D> Do you really want to exit ([y]/n)? y $
If you install some optional requirements, you can get:
$ cat dev-requirements.txt # for live code updates livereload # for ipython notebook tornado pyzmq $ pip install -r dev-requirements.txt ... $ ipython notebook <CTRL+C to quit> $ livereload -p 8000 <CTRL+C to quit>
To actually use LiveReload, you need a browser extension for chrome which can be downloaded here:
We're going to ssh into a remote server in the final hour of the course for deployment.
To do this, we're going to need to add your public key to the server's list of "authorized keys".
If you are already a Github user or remotely manage servers with SSH, then you probably don't need to generate a new public key, but I've included these instructions here for those of you who don't already have public keys.
Do you get output like::
If so, you do already have a public key.
SSH has a small configuration file at
~/.ssh/config that allows you to
specify hostnames that ssh will use.
Upon connecting to a server, ssh looks for an identity file for public key
authentication. This is typically
This private key has a matching public key, which is typically
and must be listed in the remote host's
ssh-keygen can create the public/private key for you. Then you need to
share the public key with me.
At the terminal::
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/user1/.ssh/id_rsa): Your identification has been saved in /home/user1/.ssh/id_rsa. Your public key has been saved in /home/user1/.ssh/id_rsa.pub. The key fingerprint is: 43:55:f0:cc:1a:9f:ff:2e:3a:a8:94:8c:f1:62:d3:b1 user1@hacknode ...
Edit the file::
$ nano ~/.ssh/config
And insert contents::
Host hacknode User shared HostName hacknode.alephpoint.com
$ ssh hacknode
It'll prompt you for a password right now, but that's OK -- just CTRL+C to abort.
To get access to the server, submit your public key via this Google Form:
There are pretty straightforward instructions for every operating system at:
But I have also pre-installed it on our
hacknode server to save us some time, if you don't want to load up your machine with it.
The slides will be web-based and downloadable. You can find information about them here:
Contact the instructor directly at firstname.lastname@example.org.