Archive
Starting web development with Python
Web development with Python has been on my TODO list for a very long time. This weekend I played with that, so I collect here some useful links.
Actually, I wanted to try Google App Engine a few weeks ago but when I saw it was Python 2.5 only, I said to myself “No way.“. However! A few days ago I noticed that GAE has experimental Python 2.7 support! What’s more, they added some long-awaited 3rd-party libraries like lxml, numpy, pil, etc. So it’s time to start playing with GAE :)
Links
* HOWTO Use Python in the web (overview)
* Python Web Development Getting Started Guide (2009, tons of links, Python/Django)
* Microframeworks
____+ Bottle
________— How to build a web app using Bottle with Jinja2 in Google App Engine
____+ Flask
________— Flying with Flask on Google App Engine
________— Flask template for GAE #1 (flask-appengine-template @ GitHub)
________— Flask template for GAE #2 (flask-engine @ GitHub)
________— Flask template for GAE #3 (flask-gae-skeleton @ GitHub)
________— project organization @SO
* Werkzeug (Flask includes Werkzeug)
* Jinja2 (The Python Template Engine, Flask includes it)
* Google App Engine
____+ How to Host your Website on Google App Engine for Free (hosting a static site)
* Amazon S3
____+ How to Use Amazon S3 for Hosting your Website (upload a static website)
Sorry for the ugly list but this wordpress theme doesn’t handle nested unordered lists correctly :(
Install Python 3.2 and/or Python 2.5 on Ubuntu 11.04
Update (20121120): Google App Engine supports Python 2.7 so there is no need any more to install Python 2.5. I consider this post outdated.
Chad Lung has a nice post on installing Python 3.2 from source on Ubuntu 11.04. The future versions of Ubuntu will come with Python 3, so maybe it’s a good time to start to discover Python 3 a bit.
Notes
The package “python3.2” exists in the Ubuntu repositories but it’s not up-to-date. If you want the latest version of Python, you’ll have to install it from source.
If you install Python 3.2 from source, make sure to install it with “./configure; make; sudo make altinstall“, where the emphasis is on altinstall. This way Python 3.2 will be installed next to your existing 2.x version(s), so your system won’t be messed up.
To figure out your exact Python version, you can do this:
>>> import sys >>> print(sys.version_info[:]) (3, 2, 0, 'final', 0)
Install Python 2.5 (update, 20110926)
Edit (20111112): Google App Engine now supports Python 2.7! At the moment it’s experimental but it works. So it’s very likely you don’t need Python 2.5 at all.
I wanted to try Google App Engline but it runs on Python 2.5 on the production servers at Google. So it’s better to test your applications locally with Python 2.5 too, otherwise there is a good chance that you develop something that runs fine on your machine but breaks at Google.
So, how to install Python 2.5 keeping the newer Python versions too? I tried the method that I described above with version 3.2 but “make” failed. But in this post I found a PPA from where you can install Python 2.5 easily. Steps to follow:
sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python2.5
Now if you want to use Python 2.5, just modify the first line of your scripts:
#!/usr/bin/env python2.5
Update: I figured out how to compile 2.5 from source. “make” produced the following error message: “/usr/include/sqlite3.h: version 3.7.4”. After “configure”, open Makefile and edit this line:
# before: # LDFLAGS= # after: LDFLAGS= -L/usr/lib/i386-linux-gnu
After this compilation was done successfully with “make”. This tip is from here.
