Lo-Fi Python

Mar 29, 2016

Getting Started With web2py

Feeling really good about my progress with web2py. The tutorial videos are comprehensive, yet easy to understand. For a beginner, the "batteries included" philosophy that web2py has embraced is a godsend. This means everything you need to get creating comes stock. I downloaded the web2py program, ran it, entered a password, and was immediately using a functional development interface.

web2py follows the Model - View - Controller software architecture - which means it separates out the activities of programs into a few different layers (please forgive my oversimplified explanations):

  • Model - Stores data / used in tutorial for database table creation (Written in Python)
  • Controller - Used to define page functions (Python)
  • Views - What the user sees (HTML/CSS/Javascript)
en300

(Image from web2py Documentation)

If you're thinking about trying web2py here's a few things that I've really liked so far:

  • I have minimal knowledge outside of a few basic concepts of server operations. web2py provides a few simple lines of code that allows quick creation of a table (done in model) and corresponding form (done in controller/view) to add entries to the table and display form submissions elsewhere on your site.
  • Right now, I'm enjoying learning about the Database Abstraction Layer (DAL), which is pretty cool because you can rapidly run and test complex server queries within it.
  • It's set up for multiple applications, so I can create and play with several projects at once, whether simple applications or more complex websites.

There are 30 videos total on the web2py documentation page, and I've only watched 11 of them but have already learned a ton. The style of the Massimo Di Pierro is great because you often pick up on some golden nuggets of coding wisdom and programming tips while he walks you through the topic.

It's pretty sweet to be able to create and manipulate a website so quickly; still need to learn more, such as pick up CSS to really make it my own. But for now I'm happy for the many small accomplishments that have been easier to reach thanks to web2py.

Update: consider using py4web, web2py's successor

See also: Useful Links for web2py Beginners

Mar 22, 2016

Choosing a Web Development Path

I have recently finished this HTML course, which recommends using cPanel to configure websites. So I bought a domain and registered with cPanel.

  • What I thought would happen in trying to create a website/app:Buy a domain and use cPanel and Python in perfect sync to create a website.
  • Reality:cPanel is configured mostly for PHP. You can run Python scripts with it, but it doesn't seem to be the most effective route from what I've read.

So I went back to the drawing board and I've simplified this down to two basic paths:

Options Languages Hosting Framework / IDE
Path 1 Build a website using Python + Python Web Frameworks and HTML PythonAnywhere or other Python friendly hosts web2py
Path 2 Use a combo of HTML, Javascript + Python, other languages cPanel, many other hosts None (AKA I'm not sure)

I'm going with Path 1 because the only language I know is Python. I hope to learn other languages like Javascript and CSS but would like to get building as fast as possible.

I found a free web hosting service called PythonAnywhere. There are other free and paid Python-friendly hosts.

Instead of the previously mentioned web frameworks, I've chosen web2py as a starter because of its compatibility with PythonAnywhere, its simplicity, easy to read documentation and relative ease of use for beginners.

  • A note on PythonAnywhere: they get 5 stars for the tutorial pictured below. It is very nice to see in the whirlwind of confusion of learning to deal with code and a new environment.
PythonAnywhere Tutorial

++ Love this opening quote from web2py Documentation: "I believe that the ability to easily build high quality web applications is of critical importance for the growth of a free and open society. This prevents the biggest players from monopolizing the flow of information."

+++ A note on web2py so far: the videos from the creator, Massimo Di Pierro, are super useful!

Update: consider using py4web, web2py's successor