Recent posts

Semerda.com Bootstrap launches on GitHub: Free for everyone!

Go and grab it!

https://github.com/semerda/semerda-com-bootstrap

Get Semerda.com Bootstrap on GitHub

About GitHub

GitHub is a distributed version control system similar to Mercurial with a free Mac client. GitHub makes it easier to collabortate with others and share projects with the universe. GitHub has grown into an application used by over a million people to store over two million code repositories, making GitHub the largest code host in the world.

Goal for Semerda.com Bootstrap: “To help ease with starting up new projects in Python on Django with jQuery, Twitter’s Bootstrap, Modernizr & Handlebars.js.”

If you have any suggestions how to make this solution better please Leave me feedback.

Cool things you will find inside

  • Plenty of internal documentation to why something is being done. Also utilize the “Ref:” URLs. They are there as a reference for the source of the content. Great for digging deeper into those specifics.
  • Settings.py split into Development & Production modes based on platform node. The base template contains the platform node wrapped in comment declaration so you can view source and see if you are running in development or production mode.
  • HTTP error 404, 500 & 403 handlers with associate Templates – these are bare atm so feel free to expand and contribute better versions. See Quora for funniest 404 pages.
  • If you add {% include ‘django_debug.html’ %} to your base.html Django Template footer you will see Debugging information in the footer of all your pages. Not recommended in Production mode.
  • Handlebars & Django Template consistencies to help use.
  • Custom Handlerbars Helpers to help with index counting in a grid table and generating Twitter Bootstrap buttons.
  • All JavaScript files are loaded using Modernizr’s yepnope, a asynchronous conditional resource loader.
  • Few custom Semerda.com JavaScript modules using the Modular Pattern. I’m a big fan of the Modular Pattern due to its encapsulation, namespacing and seperation of concern possibilities.
  • What custom Modular JavaScript you will find under /media/js/
    • semerda.com.common.js – highlight the correct primary navigation tab based on page visited.
    • semerda.com.analytics.js – wrapper for Google Analytics (GA) to automatically tag all links on page by parsing the DOM for href. Also uses “data-ga” attribute (where present) to push custom labels for GA event tracking.
    • semerda.com.browserstorage.js – for HTML5 supported browsers the JSON load uses either the browser local or session store to work with the JSON data. Default is always local store. Great for use with JSON/API call data you want to cache locally vs constantly making calls to the API – see /about/ page for this example in use.

Frameworks used

  • Django: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • jQuery: The Write Less, Do More, JavaScript Library: A fast, concise, library that simplifies how to traverse HTML documents, handle events, perform animations, and add AJAX.
  • Bootstrap, from Twitter: Simple and flexible HTML, CSS, and Javascript for popular user interface components and interactions.
  • Modernizr w/ yepnope.js: Modernizr is an open-source JavaScript library that helps you build the next generation of HTML5 and CSS3-powered websites. yepnope is an asynchronous conditional resource loader that’s super-fast, and allows you to load only the scripts that your users need.
  • Handlebars.js: Minimal Templating on Steroids: Handlebars provides the power necessary to let you build semantic templates effectively with no frustration. Mustache templates are compatible with Handlebars, so you can take a Mustache template, import it into Handlebars, and start taking advantage of the extra Handlebars features.

Thanks to

makinacorpus (Makina Corpus) for custom template tag code to get around handlebars mustache tags which are natively parsed by Django templating engine. Ref: https://github.com/makinacorpus/django-templatetag-handlebars

References

The following are blog posts I have written in the past which will help you when working with the code in Bootstrap Semerda.com.

A bit about the author Ernest Semerda

Bsc. Comp Sci & AGSM MBA. I Lead & Code for Coupons.com. Prior software architect at AMP Ltd, later CTO of Couponstar Ltd followed by an acquisition by Coupons.com, a $1B company. I am an Aussie entrepreneur & software engineer working on refreshing & innovative products in Silicon Valley like GTDfaster, Facebook ReadingList app et al.

This is my personal website: http://ernestsemerda.com/

I am responsible for the following properties

  • The Road to Silicon ValleyThis blog. A Blog which provides tools and resources to anyone wanting to come and work in Silicon Valley’s high tech industry. Experience is based on my own personal journey arriving in Silicon Valley on March 2009.
  • GTDfaster iPhone app – GTDfaster rests on David Allen’s principle of Getting Things Done (GTD). That a person needs to move stuff out of the mind by recording them externally into a trusted source. GTDfaster is this trusted GTD source. Also has a seperate posterous blog on GTDfaster.
  • Facebook Readinglist app – A popular free Facebook app to help you share, inspire & create a collection of books you have read, want to read or are reading. Start influencing your friends on Facebook today.

To-do list for Semerda.com Bootstrap

There is always a never ending to-do list. If you want to dd anything to it please feel free to.

  • Separate Handlebars Helpers into Standard & Twitter specifics.
  • Give SEMERDA prototype object a unique handle like jQuery does with $. Maybe use “$S”. This should shorten the calls a bit.
  • Throw in more Modernizr examples for Browser detection versus feature detection. Always aim for browser detection hence why we are using Modernizr here. We do not want to block users but gracefully degrade the experience where required.
  • Provide a set of minified semerda.com.xyz custom JavaScript modules. For now just use [Google Closure Tools](https://developers.google.com/closure/) to do the minification.
  • Add a real API vs calling /json/my_data.json dummy data.
  • Add some funny custom 404 pages. Inspired by Quora for funniest 404 pages.
  • Add Django Debug Toolbar – A configurable set of panels that display various debug information about the current request/response.
  • Add Python Modules examples and associated Unit Tests.
  • Add Django Middleware example and associated Unit Tests.
  • Cleanup/feedback from users – that’s you 🙂

Go and grab Semerda.com Bootstrap and enjoy the ease of building powerful Python based apps. Semerda.com Bootstrap primetime: https://github.com/semerda/semerda-com-bootstrap

Enjoy!
~ Ernest

Let’s go Sailing in Hawaii

Every year my wife and I celebrate our wedding anniversary by doing something a bit different or memorable, something that takes us out of our routine and reminds us why we started this journey together. This year, we decided to go on a boat and sail around the Hawaiian islands. The experience was peaceful and exciting at the same time—open water, warm breeze, and views that felt almost unreal.

In one of the restaurants we visited during the trip, there was a beautiful decoration setup that stood out to us. It reminded me of using white chair covers for weddings, the kind that instantly brings back memories of our own special day. Small details like that can unexpectedly take you years back in time.

Living and working in America gives us plenty of choices when it comes to travel and experiences. Hawaii is only about a 5-hour flight away, and it’s surprisingly accessible with relatively affordable round-trip tickets, often just a few hundred dollars.

On a more personal note, I also came across something meaningful while browsing for anniversary keepsakes—“Brisbane made sapphire ring for sale”—which made me think about how special it is to find unique pieces that carry both beauty and memory, just like our celebrations do.

We found Kainani Sails operated by Brian “Keao” Shaw & Iwa Hartman on AirBnB.

If you want to feel the true magic of the Maldives, staying in Niyama Private Islands beach pool villas Maldives is your next ‘perfect honeymoon’ idea.

AirBnB is where you get to rent from real people – not hotels or larger charter businesses. We wanted this to be “personal” and special holiday and not have to rush everywhere we visit. Basically doing it at our own pace. Kainani Sails has a boat which is a fully equipped 43′ sailing yacht. It is also their home. Perfect. Let’s go!

Our sailing trip route. Yellow icon was the start & finish. Click map for larger view.
This is us! From left clockwise: Iwa (Crew), Keao (Captain), Urszula & Ernest (me)

What you need to know:

  • You will sail in a fully equipped 43′ sailing yacht. It has kitchen, 2 bathrooms (again don’t expect a hotel bathroom), living room, master cabin with a comfy queen size mattress and 2 smaller cabins and an engine so you can still move when the wind is down. See pictures of it here.
  • There is fresh water on board for bathrooms and drinking.
  • Captain Brian “Keao” Shaw has around 10 years of sailing experience and is USCG certified. Having grown up in Hawaii he also knows the local waters very well.  He will even turn on the motor when a whale is sited to make them aware of us – that’s caring for nature. With Iwa Hartman as his crew you are in great hands. They know how to fix up the yacht and have all the necessary equipment (check out this post if you need marine equipment).
  • On board you will also find surfboards, snorkeling & fishing gear, a 2-person kayak, deck chairs, a small library, outdoor grill, and a 10′ tender with a 15 hp outboard known as the “Zodiac”. Your taxi shuttle to the shore.

Things to prepare before:

  • To prevent nausea and vomiting caused by motion sickness ask your GP for prevention pills. We received Transderm Scop in 10 patches (a 30 day supply). Each patch goes behind your ear and lasts for 3 days.
  • A rashguard to keep yourself from getting burnt by the sun. You will be on the boat, snorkeling, surfing etc… always in the sun. This will protect you from the UV.
  • waterproof housing for your camera. The world below is amazing. You will regret it if you do not have a camera capable of taking video or photos underwater.
  • A book or an iPad with digital books. There’s nothing like kicking back reading a book and watching the sun set or early in the peaceful morning indulging your mind.
  • You and Keao will create your meal schedule to make sure you eat healthy. Done before your trip via email.
  • A waterproof jacket from Vest Home deals When crossing the channels between the islands the wind picks up and waves get larger. You may get splashed when sailing.
  • LED headlamp / torch. When the sun sets you will want additional / personal lighting.
  • Buy some snacks, red wine & alcohol before you board. My favorite is the Chopin Vodka, 4 times distilled and rated well in San Francisco for the last 2 years.

My favorite things to do on the boat

  • My sleeping habit changed from 3am – 8am (ahh the life of an entrepreneur software engineer) to 9:30pm sleep and 6:00am wake up as the sun rises. My body naturally went into this cycle with the sunset and sunrise rhythms. I had a ton of energy each day without a need for caffeine. I did not drink a single drink with caffeine while on board.
  • Sleeping on the stern (back of the boat) under the stars. I created a nice comfy bed and slept under the stars each night – simply amazing! Without any light pollution you could see every star possible with the naked eye. I felt like the character in Altered States tapping into evolutionary state when our ancestors used to sleep under the stars.
  • Sit at the bow (front of the boat) on deck chairs with your partner to enjoy the open seas as you sail.
  • The master cabin has 2 roof windows which open up. Sneaking in and out of the cabin via these windows felt like being a kid again.
  • Take stunning photos from all corners of the boat. Just hold on tight coz the boat does rock with the ocean and leans during full sail.

Our journey begins

Saturday (Feb 18)

  • For short trips of around a week its cheaper (with coupon) & more convenient to leave your car at the airport parking which was just remodeled by local contractors you can also hire if you click here.
  • We flew out of flew out of Oakland International so parked our car at Park ‘N Fly.

Lahaina Bay – Home for the next week! Aloha!!

  • We flew Hawaiian airlines Boeing 767 into Kahului Airport on Maui (Hawaii). That’s the top part of the island. It’s best to catch a shuttle bus (which fits around 10 people) from the airport to Mala Harbor (the south side of the island in Lahaina). A 1-hr car ride. Grab the shuttle bus as soon as you walk outside the airport.
  • Captain Keao picked us up from the bay on the “Zodiac” (outboard) and took us to the fully equipped 43′ sailing yacht parked further in the Lahaina Bay.
  • Having arrived to the sail boat, we were greeted by Iwa (his crew) and helped on board. I must say this was a very friendly welcome and we felt like at home straight away. Thanks folks!
  • That afternoon we watched an amazing sunset and then star gazed. Using an iPhone app Sky Safari to identify the stars, planets & constellations was super fun… before falling asleep under the stars.
Sunset over Lanai

Sunday (Feb 19)

  • Early morning we set off sail to Honolua Bay. This is the west side of Maui. It was a 5 hour journey and Urszula got to sail the boat under Captain Keao’s supervision. Here’s a nice video of our sailing treck .
  • The private residence bay was amazing. Rich in corals and surrounded by rocky cliffs with 2 beaches where about 2 dozen surfers were catching 6 foot breaks coming from the open sea along the cliff faces. So Keao and I grabbed 2 surfboards (the boat carries 3 surf boards) and we paddled to the break. We had a kick ass time while Urszula went snorkeling & underwater recording with Iwa.
  • As the sun was setting a large pod of Spinner Dolphins came into the bay. I call them Tunas because they the young ones look it. They are famous for their acrobatic displays in which they spin along their longitudinal axis as they leap through the air. Urszula and Iwa set out on a kayak to get closer to these amazing creatures .
Spinner Dolphins playing with us in Honolua Bay. Click pic for larger view.

Monday (Feb 20)

  • We set out sail early towards Maunaloa on Molokai island. A secluded place that reminded me of the 1st episode of Planet of the Apes (1968) when the crew crash lands on a planet in the distant future. Nothing but beach, sand and mother nature.
Molokai
  • Molokai is the fifth largest of the main Hawaiian Islands. It is one of the least touristy islands and very native.

Tuesday (Feb 21)

  • We departed before sun rise to beat the winds while crossing the channel. However we hit some pretty crazy winds and the seas were angry my friends. I was thinking Mavericks! This was the time I gave in and plonked motion sickness patch on and the waterproof jacket.
  • When we hit Lanai’s Au’au channel the winds settled and oceans calmed down and turned deep blue. I have never seen anything like this before.
Lanai cliff faces west facing
  • We stayed the night in a secluded bay near these amazing rock cliff faces where Urszula came face to face with a 3 meter shark in the coral rich bay.
  • It was funny to watch those touristy charter boats come in loaded with people, they bobbed out for 30 minutes into the water and had to get back on the boat to leave again. What a rush. Did the tourists even get a chance to take in the beauty of the surroundings and underwater. While we kicked back and snorkeled at our own pace taking in everything nature had to offer.

Wednesday (Feb 22)

  • We headed into Lanai Bay and parked the boat amongst other boats. This was a big change to the secluded areas we visited earlier. A lot more populated.
Lanai bay
  • Lanai is sixth-largest of the Hawaiian Islands. A privately owned island. It is also known as the Pineapple Island because of its past as an island-wide pineapple plantation. The only town is Lānaʻi City, a small settlement. Lanai has the longest stretch of coral reef in Hawaii and the beaches on this island are down right deserted.
Secluded cove near Four Seasons at Manele Bay
Secluded cove near Four Seasons at Manele Bay
  • I highly recommend you visit the Four Seasons Lanai at Manele Bay. A brief walk from the bay and they have great Mojitos (my favorite).
  • The beach at the base of the hotel is also amazing with fascinating tide pools, great snorkeling, red sea cliffs and a stunning cove.
Four Sesons beach at Manele Bay

Thursday (Feb 23)

  • We loved Lanai so much we set sail back to Maui later in the afternoon.
  • Stopping along the way in the middle of the ocean and jumping off the bow to hear the Whales sing under water. (see video) and to feed some crazy black fish (see video). hehehe that was fun! I think they wanted to feed on Urszula.
Sailing back to Maui
  • Sailing back to Lahaina Bay I took charge of being the Captain hehe under Keao’s training around the instrumentation and reading the sails/winds I sailed us back into Lahaina while we all enjoyed the amazing sunset.
Please call me… Captain!

Friday (Feb 24)

  • Early morning we hit the surf in Lahaina Bay with our surfboards. Plenty of people catching perfect waves.
Surfs up!
  • Lunch time we said our goodbyes – it was tough after such an amazing week with Iwa & Keao. Not only did we have an amazing time but we also made friends. That is something we will never forget. Keao dropped us off at Lahaina bay port where the friendly folks at Enterprise car rental picked us up for the next journey in Maui.

Wow, we sailed in Hawaii

We couldn’t have asked for a better trip. Both Keao and Iwa were outstanding hosts. From looking after us with healthy food (we got some recipes), entertainment, history lessons of the sights, sailing lessons to opening up their stunning waterfront property (the 43′ sailing yacht) to us. We felt like we were at home but away from home. Urszula counted 76 Whales during our trip! I started to call this whale pollution because there were so many of the them hehe I really decompressed and disconnected from my reality and lived a life which I can only compare to what I believe our ancestors did once when they were one with nature.

Here’s a short video of our trip

Want to experience the same?

Everyone should at least one in their life sail. Especially around beautiful Hawaii.

Check out more photos here on Flickr

Here’s how to get in-touch with Keao or Iwa from Kainani Sails:

Videos you should watch:

Enjoy!
~ Ernest

Tips on travelling in the USA

The following list is by no means complete or exhaustive of everything one needs to know to travel in the USA. This is a list of stuff I learnt in the last 1 year of travelling around USA including the visit to a mountain resort with entertainment. These I share with you now and will regularly update as I learn more and any corrections along the way.

If you are planning a road trip I recommend you to consider the option of the campers that camper trailers Sydney have available for this purpose.

Tips

  • Use a “SuperShuttle” to and from the airport. http://www.supershuttle.com/it’s a shared taxi van of around 9 people. It’s dirt cheap vs. crazy taxi fares and you get to see more of the area as they drop off people around town.
  • If you live in the valley and have your own car and are taking a short trip of around a week it is cheaper esp. with a coupon & more convenient to leave your car at any of the available airport parking companies. Some which are further away from the airport have shuttle buses that take you to the airport and back for free so don’t worry if it’s 5 minutes outside the airport.
    • If flying out of Oakland International we use Park ‘N Fly and use this coupon to get a discount on parking.
    • If flying out of SFO International we use SkyPark and use this coupon to get a discount on parking.
    • Don’t be shy with the coupons. Everyone in America uses coupons to bring the price down even further!
  • If you are arriving to the USA don’t bother bringing your wardrobe. Clothes here are cheap. Dirt cheap. Brands and all. Especially during public holidays like Thanks Giving or Christmas time by average 50% off.
  • If you need to rent a car do it through Enterprise. I find them the most reliable and mostly the cheapest. Sign up on their website to receive regular coupons to bring that price down and don’t forget to read my post on car rental hidden costs to save even further.
  • For accommodation I highly recommend AirBnB. Airbnb is an online service that matches people seeking vacation rentals and other short-term accommodations globally with locals with rooms to rent. It’s fun, cheaper than hotels, you can be very selective on location (not restricted by hotels location), meet interesting people and live like a local. It works really well in big cities like New York, San Francisco, Los Angeles, etc.  Why spend big $$$ on a hotel when all you need is a place to sleep and store your luggage. Use the money you save to buy some fashion!
  • Americans drive fast on freeways that stretch up to 5 lanes each way. Get ready. Either hire a GPS or bring your own so you’re not slowing traffic down. As long as you’re not doing anything dangerous on the road you will be fine to keep up with the communal speed limit. I’ve seen police sway across all lanes to slow traffic down when it gets too fast. While law enforcement is tasked with keeping traffic under control, it’s essential that their actions are just and appropriate. With Seattle police misconduct attorneys by your side, you can confidently navigate the legal process and pursue justice for incidents of misconduct.
  • When it comes to food there are great restaurants in every corner, asking the locals helps a lot as well. For example, I was highly recommended Biloxi Buffet and it did not let down!
  • The only dangerous creatures are Bears (especially Grizzly) & Mountain Lions. You wont see poisonous spiders, snakes or crazy insects.
  • For more tips visit each of the places mentioned below. The posts include their own unique tips.

Some of the great places we have visited

  • New York City (Manhattan) – The city that never sleeps. My favorite! One of the most densely populated areas in the world. Known for its financial and fashion center of both the United States and the world.
  • Los Angeles – West Hollywood. Home of the movie industry.
  • San Francisco – Home of the high-tech scene and area known as Silicon Valley.
  • Hawaii – Made up entirely of islands like Big Island, Maui etc. Natural scenery, warm tropical climate, abundance of public beaches and oceanic surrounding, and active volcanoes make it a popular destination for tourists.
  • Monterey – 1-hr drive south of the valley. A beautiful coastal city.
  • Carmel-by-the-sea – a hidden gem round the corner from Monterey. The beachy town is known for its natural scenery and rich artistic history.
  • Yosemite National Park – Designated a World Heritage Site recognized for its spectacular granite cliffs, waterfalls, clear streams, Giant Sequoia groves, and biological diversity. Almost 95% of the park is designated wilderness.
  • Yellowstone National Park – a national park located primarily in the U.S. state of Wyoming known for its wildlife and its many geothermal features. If you’re traveling with a group, you’ll want to consider the Nest Travel Trailer. The Nest Travel Trailer from Airstream has much to offer: a sleek design profile, soft touch panels, and a beautiful exterior. In addition, it provides a full onboard wet bath, space to work and eat, and comfortable sleeping quarters. Whether planning a weekend getaway or a cross-country journey, this travel trailer is the perfect solution to your travel needs.
  • Las Vegas – The Strip. Internationally renowned major resort city for gambling, shopping, partying (clubs) and fine dining, according to every review on established gambling review sites like piramindwelt.com. If you want to access various casino games at the comfort of your home, you may use this joker123 apk login.

I will be posting individual posts to each of those locations with photos so come back soon.

~ Ernest

Gentle Introduction to Python

Right, let’s dig into my favorite language. Python. It’s super easy to read & learn, it’s concise and one of the hot languages in Silicon Valley. In fact, Python is also one of the easiest languages to grasp if you want to learn to code on mobile.

The following assumes you understand basic software engineering concepts.

A bit about Python

  • Design philosophy emphasizes on code readability. Important because software engineers spend most of their time trying to understand code. (Ref Coding Horror)
  • Has a nice MVT open-source web framework called Django. Django emphasizes reusability and pluggability of components, rapid development, and the principle of DRY (Don’t Repeat Yourself).
  • It features a fully dynamic type system with late binding (duck typing) and automatic memory management, similar to that of Scheme, Ruby, Perl, and Tcl. More here.
  • Runs on LAMP, where the P = Python. Here’s how to set it up.
  • Currently one of the hottes languages (alongside Ruby/Ruby on Rails) in Silicon Valley especially among startups.

Sample of popular sites build in Python

Google, Dropbox, Reddit, Disqus, FriendFeed (Sold to Facebook to drive their News Feeds), YouTube, Quora (rising star), Douban. Comprehensive list here.

Python

  • Uses whitespace indentation, rather than curly braces or keywords, to show & delimit block structure. I prefer 4 spaces.
  • Everything is an object (first class) and everything has a namespace accessed by dot-notation.
  • Naming convention UpperCamelCase for class names, CAPITALIZED_WITH_UNDERSCORES for constants, and lowercase_separated_by_underscores for other names. See Python style guide and The Zen of Python for guiding principles for Python’s design into 20 aphorisms. Basically write self-documenting code by chosing explicit naming convention.
  • A comment starts with a hash character (#). For longer then a line (and as Doc strings) use triple quotes: ”’ xyz ”’.
  • Variable names have to start with a letter or underscore, and can contain numbers but no spaces or other symbols.
  • File extension is always .py. If you see .pyc this is source code compiled into bytecode for execution by a Python VM (virtual machine).
  • Use command line python shell to test assumptions by getting immediate results.
  • No case/switch statements. Switch is better solved with polymorphism (object that has more than one form) instead. Good example here.
  • Data types
    • Immutable (can’t be updated or changed): strings, tuple, int, float, complex, bool
    • Mutable (can be updated or changed): list, dictionary (dict) & mutable except for it’s keys
  • Editors I use: IDLE (for basic shell work & comes with Python.org install), PyCharm (with Django support) and Sublime Text 2 (lightweight TextMate replacement).

Basics

Arithmetic Boolean
2 > 3 → False
2 == 3 → False
2 The opposite of == is != (“not equals”):
2 != 3 → True
You can chain together comparison operators:
2 < 3 < 4 → True
Equality works on things besides numbers:
“moose” == “squirrel” → False
True and True → True
True and False → False
True or False → True
not False → True
(2 < 3) and (6 > 2) → True
Under the hood,
True is equal to 1,
and False is equal to 0.
Booleans are a subtype of integers.

Operators

== Equal to
!= Not Equal to
is Identical
and Boolean and
or Boolean or
& Bitwise and
| Bitwise or
not Boolean not (not the !)

Built in functions that are always available

len(s) Return the length of an object. Can also be a sequence (string, tuple or list) or a mapping (dictionary).
print(obj) Print object(s) to the stream file.
help(list) See basic help on any object.
dir(list) Return a list of valid attributes for that object.
type(list) Return the type of an object

More built in functions here: http://docs.python.org/library/functions.html

Functions

Always starts with a “def” and ends with “:”.

# define a new function with 1 default argument. Can also have no arguments.
def function_purpose(arg1=1):
     ''' This is a doc string '''
     print 'Python code'
     return (arg1, arg1+7,) # returns 2 values as a tuple (note the comma), else None
# call the function, returns a tuple that we assign to 2 variables
item1, item2 = function_purpose(1)

If you want to assign a value to a variable outside the function within a function you must prepend the variable with “global”.

Calling methods on objects

Just like calling functions, but put the name of the object first, with a dot

words = 'some monkeys here'
e = words.count('e')
# returns 4

Strings

Are a sequence of characters.

# creation
name = 'Ernest Semerda'

# accessing, returns 's'
name[4]

# splitting, returns a list ['Ernest', 'Semerda']
the_string.split(' ')

Strings can be subscripted/sliced like the list (see lists in Data Structures below).

# selected range returns 'nest '
name[2:5]

# get first two characters returns 'Er'
name[:2]

# get everything except the first two characters returns 'nest Semerda'
name[2:]

Sample of  some string methods. They come with 8-bit & Unicode support.

name.capitalize() # changes to 'ERNEST SEMERDA'
name.find(sub[, start[, end]])
name.lower()
name.split([sep[, maxsplit]]) and new_name.join(list)

More string methods: http://docs.python.org/library/stdtypes.html#string-methods

Data Typing

Python is strongly typed which won’t allow you to automatically converted from one type to another.

Python also has a strong tradition of duck-typing (dynamic typing) in which an object’s current set of methods and properties determines the valid semantics. Trusting that those methods will be there and raising an exception if they aren’t. Be judicious in checking for ABCs and only do it where it’s absolutely necessary.

An important feature of Python is dynamic name resolution (late binding), which binds method and variable names during program execution.

# fails because (str + int + str) != str
'There are ' + 8 + ' aliens.'
# perfect, str() = type conversion
'There are ' + str(8) + ' aliens.'

To achieve Reflection, a process by which a computer program can observe and modify its own structure and behavior, use the built-in functions. I.e. getattr

Over a “sys” module’s method “path”:

path = getattr(sys, "path")

Over a function1 with sample input:

result = getattr(sys.modules[__name__], "function1")("abc")

And/or use the Reflection Utilities API for deeper execution frame, execution model, class/obj inspection for methods & attributes etc… See: http://docs.python.org/c-api/reflection.html

Data Structures

Dictionary

Set of key:value pairs. Keys in a dictionary must be unique. Values Mutable.

# creation, empty dictionary
peopleDict = {}

# creation, with defaults
aliensDict = {'a':'ET', 'b':'Paul', 'c':42}

# accessing, returns 'ET'
aliensDict['a']

# deleting, 'Paul' is removed from dictionary
del alientsDict['b']

# finding, returns False (note capital F)
aliensDict.has_key('e')

# finding, returns ['a', 'c']
aliensDict.keys()

# finding, returns [('a', 'ET'), ('c', 42)]
aliensDict.items()

# finding, returns True
'c' in aliensDict

Lists

Lists can carry any items ordered by an index. Lists are Mutable.

# creation, empty list
peopleList = []

# creation, with defaults of any type
codesList = [5, 3, 'p', 9, 'e']

# accessing, returns 5
codesList[0]

# slicing, returns [3, 'p']
codesList[1:3]

# finding, returns ['p', 9, 'e']
codesList[2:]

# finding, returns [5, 3]
codesList[:2]

# returns ['p', 9]
codesList[2:-1]

# length, returns 5
len(codesList)

# sort, no return value
codesList.sort()

# add
codesList.append(37)

# return, returns 37
codesList.pop()

# remove, returns 5
codesList.pop(1)

# insert
codesList.insert(2, 'z')

# remove
codesList.remove(‘e’)

# delete
del codesList[0]

# concatenation, returns ['z', 9, 'p', 0]
codesList + [0]

# finding, returns True
9 in codesList

Apply set(list) and it becomes a set – an unordered collection with no duplicate elements. Also support mathematical operations like union, intersection, difference, and symmetric difference.

Tuples

Tuples are similar to lists: they can carry items of any type & useful for ordered pairs and returning several values from a function. Tuples are Immutable.

# creation, empty tuple
emptyTuple = ()

# note the comma! = tuple identifier
singleItemTuple = ('spam',)

# creation, with defaults of any type
codesTuple = 12, 89, 'a'
codestuple = (12, 89, ‘a’)

# accessing, returns 1
codesTuple[0]

More on data structures here: http://docs.python.org/tutorial/datastructures.html

Control & Flow

For loop

# Collection iterator over dictionary w/ tuple string formatting
people = {"Ernest Semerda":21, "Urszula Semerda":20}
for name, age in people:
    print "%s is %d years young" % (name, age)

To loop over two or more sequences at the same time, the entries can be paired with the zip() function.

More on string formatting operations here: http://docs.python.org/library/stdtypes.html#string-formatting-operations

For loop with if else

# Iterate over a sequence (list) of numbers (1 to 10) with if/else Conditionals. The range function makes lists of integers.
 for x in range(1, 10):
     if x == 8:
         print "Bingo!"
     elif x == 10:
         print "The End"
     else:
         print x

While loop

# using request to ask user for input from interactive mode
request = "Gimme cookie please: "
while raw_input(request) != "cookie":
    print "But me want cookie!"

Switch-statements do not exist. In OO they are irrelevant & better solved with polymorphism instead. Examples here.

More control flow tools here: http://docs.python.org/tutorial/controlflow.html

Golfing!

Chaining into few lines.

[x * x for x in [1, 2, 3, 4, 5]]
# returns [1, 4, 9, 16, 25]

Can get messy & complicated to read.

print [x * x for x in range(50) if (x % 2 ==0)]
def is_palindrome(word):
    word = re.compile(r'[!? ]').sub("", word.lower())
    return True if word == word[::-1] else False

Files

# open, defaults to read-only + note single forward slash
contents = open('data/file.txt')

# accessing, reads entire file into one string
contents.read()

# accessing, reads one line of a file
contents.readline()

# accessing, reads entire file into a list of strings, one per line
contents.readlines()

# accessing, steps through lines in a file
for line in contents:
    print line

More on IO: http://docs.python.org/tutorial/inputoutput.html

Classes

All methods (but not functions) are closures – see “self” below. A closure is data attached to code. All variables are public, private variables are established by convention only.

# SuperHero inherits from Person class - also supports multiple inheritance using comma
class SuperHero(Person):
    # constructor
    def __init__(self, name):
        self._name = name

    # method
    def shout(self):
        print "I'm %s!" % self._name

The __name__ below allows Python files to act as either reusable modules, or as standalone programs. Also think Unit Tests benefits!

if __name__ == '__main__':
    # instantiate the class
    batman = SuperHero('Batman')

    # call to method in class, returns "I'm Batman!"
    batman.shout()

    # returns "I'm Batman!"
    SuperHero.shout(batman)

More on Classes in Python here: http://docs.python.org/tutorial/classes.html

Modules

Modules are Libraries that hold common definitions and statements. They can be combined into an importable module.
More on modules here: http://docs.python.org/tutorial/modules.html

To use a module, use the import statement:

import math

# returns 1.0
math.sin(math.pi / 2)

Some commonly used modules

  • math – trigonometry, the constants e and pi, logarithms, powers, and the like.
  • random – random number generation and probability distribution functions.
  • os – tools for talking to your OS, including filesystem tools in os.path.
  • sys – various system information, as well as the handy sys.exit() for exiting the program.
  • urllib2 – tools for accessing Web resources.

Useful modules: http://wiki.python.org/moin/UsefulModules

Error & exception handling

import sys
try:
    f = open('myfile.txt')
    s = f.readline()
    i = int(s.strip())
except IOError as (errno, strerror):
    print "I/O error({0}): {1}".format(errno, strerror)
except ValueError:
    print "Could not convert data to an integer."
except:
    print "Unexpected error:", sys.exc_info()[0]
    raise

More: http://docs.python.org/tutorial/errors.html

Fun – easter egg; The antigravity module

Released in Google App Engine on April 7, 2008. The antigravity module (http://xkcd.com/353/) can be enabled like this:

import antigravity

def main():
    antigravity.fly()

if __name__ == '__main__':
    main()

Speed – always a common topic

Classic computer programs had two modes of runtime operation = interpreted (as code runs) or static (ahead-of-time) compilation.

Just-In-Time compilation (JIT), also known as dynamic translation is a new hybrid approach. It caches translated code (bytecode into native machine code) to minimize performance degradation. Used in .NET, Java & Python via PyPy.

PyPy is a fast, compliant alternative implementation of the Python language. It has several advantages and distinct features like Speed (Just-in-Time JIT compiler), Memory usage (better then CPython), Compatibility (works with twisted & django frameworks), Sandboxing (run untrusted code), Stackless (providing micro-threads for massive concurrency). Check it out: http://pypy.org/

Recommended

Books

Websites/following

Finally, it is important that you have a network of like minded people around you whom you can regularly work on Python with, bounce ideas & question and support (help) each other out.

Happy Learning and if you have any questions please contact me. Always happy to help.

~ Ernest

Couponstar – my lessons building an international company

Couponstar Ltd, formerly Cashstar International and later Coupons.com Ltd (post acquisition in late 2011) was a journey I will never forget. A journey which changed me. From being a corporate guy to an international entrepreneur. The 5 years building Couponstar Ltd from ground up were boisterous, convivial and challenging. It is also what took me on a journey to Silicon Valley and ignited this blog.

The journey

It all started back in Sydney, Australia, on January 2004. Having been made redundant from AMP Pty Ltd (the best thing that ever happened to me) I joined Cashstar (as it was formerly known) to work with Jared K (a 2 man team) in changing the retail world using coupons.

Early days

We were in the market providing coupon and media solutions to the gaming and entertainment industry in Australia. We licensed Coupons, Inc. technology outside North America and set out to “couponize” the rest of the world with our high-tech customized solutions which were aimed to drive online traffic into bricks and mortar stores.

Couponstar, as it was formerly called. Now Coupons.com Ltd

Below is a picture of the early days (vintage 2004) when it was only me and Jared. We drove 800km in my car from Sydney to Melbourne to attend ADMA (Australian Direct Marketing Association) trade show. Airfares in Australia back then were expensive.. ahh the memories of those early days. I (a software engineer) also got to learn some sales techniques from Jared and via the experience of marketing to customers at ADMA.

From left: Me (Ernest) and Jared Keen (founder of Couponstar Ltd)

The tall blurry banner in the picture above was something we did ourselves in-house to lure by passes getting hooked on trying to read it properly. Then Jared and I would swoop in.

On top of sales & marketing with the help of experts like VICTORIOUS, I also got involved in every aspect of strategic, operational, technical & engineering tasks while we grew the business. Jared & I even folded print & mail envelopes on the floor of our rented space. Hey it had to be done!

Early pivot

With time we grew to a small lean team of 6 in the Sydney office. After a lot of sweat, we also realised early on that Australia just wasn’t the right market for what we were doing. Australia (even today) is slow to adopt new disruptive technology.

So we decided to pivot and opened an office in London under Couponstar Ltd. We realized that Europe had more potential since the market was far greater than Australia and the concept of coupons (vouchers) was partially engraved into the culture for over a century.

Our determination, forward movements and the never say die attitudes sparked Coupons.com’s interest and they invested in us. This helped with the UK & ultimately European expansion. Bonus!

Acceleration

Fast forward to the end of 2008 and Jared and I were in discussions to work out what is the best way forward for the business. Working across multiple continents  Australia, USA and Europe was very taxing on us and we knew there were better alternatives. I proposed I come to Silicon Valley and run the international engineering team from Coupons.com and Jared would go to London to focus on the European market from there. It made perfect business sense. And it was also already on Jared’s mind. Bang! Let’s do this.

So I set off on my journey to Silicon Valley in March 2009 and Jared to London. The International business flourished and expanded fast and in late 2011 I got my exit. Couponstar was 100% acquired by Coupons.com. Ultimately giving Coupons.com an International presence. Looking to start a business? Start an LLC today.

Below is what the UK office looks like today, 2012. Nicely staffed team of smart folks.

Couponstar UK office in 2012

Top 6 lessons

In August 2012 I decided to move on to a new venture and start my own business in Silicon Valley. I am a co-founder / CTO (hello again) of Medlert Inc. We combine industry expertise with innovative technology to deliver critical information to your family, doctor/s and emergency response units to save your life in an emergency. Powered by leading edge secure and encrypted technology to save lives fast.

Yes it’s a totally different shift from saving people money to saving lives.

But before I end this, here are the top 6 lessons from Couponstar days (in no particular order):

  • Customer is no#1. It is alot harder to get a new customer then look after your current one. Your current customers took alot of hard work to bring on board – look after them! I’m sure you have heard to “always under promise and over deliver.”. We always over delivered and made sure the customer was happy and if not asked how we could improve.
  • Business intelligence (data) is super important. Collect collect collect and Analyse analyse analyse so you can understand pain points, what isn’t working and what is. This allows you to create action points to correct what isn’t working so that the customer can see the value in your solution and feel confident about their decision. We used a host of client and server side analytics along with feedback forms throughout our service to collect this data. We also found that trends can be a great indicator of something having gone wrong so being able to correct it early is key. Without data, this would not be possible.
  • Fire fast. The worst is having an unproductive employee dragging not only you but also your team. The rest of the team is very well away of others who are unproductive and this has the potential to rub off on them. So fire fast! Have a chat with the under performer to find out what is going on and should it repeat give them a formal warning and if it repeats again – fire. Your competitors aren’t going to stop while you sort out your internal mess. Act fast.
  • Never run a data center in-house. This point might not be relevant in today’s times since the boom of cloud computing but still requires mentioning. If data center management is not in your specialty or it takes too much red tape to set up in-house forget it. Leave it to the pros and let them manage it. Believe me, you will sleep better at night, scaling will be a thing of the past and your bills will be much lower.
  • Automate everything you can. If you find yourself repeating something too many times. Automate it. Conversion Factory are the SaaS growth experts. From data capture to reports. Spend some time automating it so you can move on and focus on stuff that really matters. Like growing the business, customer base, tailor your marketing to specific audiences, technology stability etc… Automation is not putting people out of a job, marketing automation is running lean and mean and most of all FASTER! Find ad inspiration on SwipeWell here.
  • Working inter-geographically is not for everyone. We all heard of outsourcing and teams working in different regions of the world – some with success and some without. Work out whether this is a good direction for your business to be pursuing, what are the pros and cons and the unforseen. We worked on GMT, EST and PST time zones – round the clock. It was a drain on people and their productivity. Unless the teams are loosely coupled it may not be worth doing this. This is just one of the reasons we decided to shut the Sydney office and move overseas. Has it worked? To some extent yet. But then you have other issues to deal with 😉

So there you have it. I got involved in helping grow a business past those critical startup years into an international company. Along the way sold to the company we partnered with and landed myself in a country where I had to start from fresh (building credit history, new home, new friends, new location, new experiences). Change is scary and also rewarding. I hope this post inspires at least 1 person to make a difference not only to their life but also the life of the people they will touch through their company. And remember, when it comes to expanding your business’s reach, consider leveraging the power of SEO, like with Roseville SEO, to boost your online presence and connect with more potential customers. For professional SEO marketing services, trust the experts like Battle SEO who can provide Battle-tested SEO strategies. Lawyers who would like to establish an online presence may seek professional lawyer marketing services. And if you are looking for the best indexing tools, then check out IndexMeNow.

~ Ernest

J.J. Abrams’ Bad Robot releases iPhone special effects app

J.J. Abrams’ company Bad Robot has released an awesome iPhone app called Action Movie FX.

J.J. Abrams is one of my favorite Directors known for awesome movies Super8, Armageddon, Mission Impossible – Ghost Protocol, Cloverfield and kick ass TV series like Fringe, Lost & Alias etc.. If you want to watch action movies and tv series online, you may use the BEST IPTV PROVIDERS GUIDE and sign up for a subscription.

He is an awesome American film and television producer, screenwriter, director, actor, and composer. J.J. Abrams makes kick ass movies and now this kick ass iPhone app. Without further ado, here’s what you too can create at home with your iPhone and Bad Robot’s Action Movie FX app.

Starring.. yours truly. Me! Ernest Semerda. Maybe I should get into the entertainment industry 🙂

Tornado hits Hacker Dojo!

Ula sent a cavalry to the Dojo.. to teach Ernest a lesson!

Ula in training!

Ula was naughty & needed to be taught a lesson 😉

Chopper touch down

Download Action Movie FX iPhone app and start making your own flix!

Enjoy,
~ Ernest

Get your @$$ to Silicon Valley

Is moving to work in Silicon Valley on your goals list? Are you a software engineer or work with technology and always craved for more? Then get your @$$ to Silicon Valley and start making a difference disrupting an industry and learning a ton load of new things in the process. Oh and Happy New Year!

Sydney 2011 NYE fireworks - nothing comes close

Here’s why you need to be in Silicon Valley

It has already started!

Aussies are leaving Australia to start tech companies in the valley. Check out this SMH article & video on this movement.

Brain drain: why young entrepreneurs leave homesource: SMH, May 18, 2012

How to get to Silicon Valley

  • Make sure you are up to date with the latest tech. Australian corporate world (common work environment) is behind with technology so moving to Silicon Valley you may need to ramp up on the tech side. There is also plenty of free education online you can take advantage of.
  • Organize an E3 (faster & easier for Aussies) or H1B (the common) Visa. You can come to Silicon Valley on your Visa Waiver Program (VWP) for 90 days (3 months), find a job and then get the Visa sponsored by the company.
  • Find a place to live in the Bay Area (also known as Silicon Valley) / San Francisco areas. If you come on a Visa Waiver Program just rent out a bedroom via AirBnB anywhere you like. Super easy and convenient until you lock down a more long-term accommodation.
  • Find a job / startup to work at. Or just contact me and I can help you out – we are hiring! A friend came here on a Visa Waiver Program and scored plenty of interviews and locked in a great job in 2 weeks.
  • Understand employment & contracts in the bay area. There are plenty of perks for great software engineers including long-term financial gains via stock options. Unlike Australia where getting stock options is next to unheard of for software engineers. Check out glassdoor.com to get a feel for the salary range in Silicon Valley.
  • Before you leave Australia make sure you have attended to the going away checklist; changed to non-resident for tax purposes, notified your banks, given power of attorney to someone you trust etc…

Need help or still not sure?

Look. If you’re a good engineer with the right attitude and want more out of life you need to be in Silicon Valley. If you fear the change it’s ok. It means your human. Contact me and I will help you with your journey from Australia to Silicon Valley and connect you with startups in the bay area.

Don’t waste another day, start today and make a difference in your career and life.

~ Ernest

The difference: Police vs Sheriff?

Your driving one day on the America roads and you see a Police car and later a Sheriff car. What gives you may ask. What is the difference between the 2 I hear you ask.. I was in those shoes and here’s what I found.

Police is city/local enforcement while Sheriff is county enforcement.

A Sheriff department will also look after a town where no Police exists. And there are plenty of small towns in the USA. Think Supernatural, when the lads visit those small towns there is always a Sheriff to be seen but never Police who always look and buy ar-15 pistols from Palmetto Armory. It also appears that a Sheriff is more bad ass since they have a bigger job, have access to SWAT, helicopters, always take 911 calls and will chase a criminal across cities throughout the county since it’s their jurisdiction.  Those who are involved in a criminal case should consult with lawyers who can answer legal questions like ‘Can the state prosecute without a witness?‘.

Now you know 🙂

How to setup Django + mod_wsgi on Apache & Ubuntu

Django is a great Web Framework which complements the Python programming language. Having switched to Python development few months ago I was on the lookout for a MVC like Web Framework that emphasizes Convention over Configuration (CoC), Rapid Development Principle of Don’t Repeat Yourself (DRY), Separation of concerns has Python as the underlying core language. And lo and behold Django proved to be that beast.

What is Django

Django is a MVT (model-view-template) framework build on the Python language. The MVT is identical to MVC (model-view-controller) but where in the common MVC pattern the view here is the template and controller the view. They both perform the same function separating the business logic from the presentation from the data layer (model). However Django does goes one step further and provides a view/template without native core language polluting the HTML.

Django emphasizes Reusability and “Pluggability” of components, Rapid Development, and the Principle of DRY (Don’t Repeat Yourself). Stuff you hear a lot with Ruby on Rails – another great web framework built on a solid language, Ruby.

Ok, enough of my rambling about how great this framework is. If you want to read more about it I recommend the following 2 links:

The LAMP stack

Ok so everyone is talking about a LAMP stack and everyone wants to run their site on a LAMP stack. Why not when you can tap into great open source tools for free. The word LAMP is a bit over emphasised since most sites today run on a custom configured implementation using best of breed open source software.

“LAMP is an acronym for a solution stack of free, open source software, referring to the first letters of Linux (operating system), Apache HTTP Server, MySQL (database software) and PHP (or sometimes Perl or Python), principal components to build a viable general purpose web server” ~ Wikipedia

Few years ago when open source software was limited, LAMP had typically meant Linux, Apache, MySQL and PHP. Today Linux can take many flavours from CentOS, Red Hat or the popular Debian-derived Linux distribution Ubuntu. The web server Apache can be replaced with a super fast & lighter HTTP and reverse proxy server called nginx. MySQL, post Oracle acquisition is often replaced with PostgreSQL or a NoSQL version called MongoDB. And PHP by cleaner & concise languages like Python or Ruby.

In this post I will cover how to setup a LAMP stack where:

  • Linux = Ubuntu 11.10. This can also work with 10.xx version of Ubuntu.
  • Apache = we will leave it as is since it is still a great web server but hook in mod_wsgi – a Python WSGI adapter module for Apache. WSGI is nothing more than an interface specification by which server and application communicate. In this case with Python.
  • MySQL = will stay with MySQL but you can also install MongoDB.
  • PHP = will be replaced with Python and drop in the Django MVT framework.

Ok let’s get started.

How to Setup Django on Ubuntu

The following assumes you have already installed Ubuntu and LAMP. If not head over to my prior posts on how to:

  1. Install Ubuntu on EC2 and
  2. Install LAMP.

Installing pre-req components

1. Standard procedure is to always run update on your Ubuntu installation.

sudo apt-get update

2. Install mod_wsgi on Apache

sudo apt-get install libapache2-mod-wsgi

3. Install Python setup tools with pip. pip installs packages. Python packages. An easy_install replacement.

sudo apt-get install python-setuptools
sudo apt-get install python-pip

4. Install Django MVT framework using pip.

sudo pip install Django

Now that’s done. Easy hey. Now let’s configure your 1st Django site.
Assuming your site will be called “purpleblue.com

Configuring your 1st Django site

5. Recall from the LAMP setup that we were storing all web sites in /var/www/ folder. For example purposes, I will use purpleblue_com as my Django project. Notice the use of django-admin.py to create the Django site and the use of underscores vs decimal point. Only numbers, letters and underscores are allowed in the Django project name.

cd /var/www/
sudo django-admin.py startproject purpleblue_com

5.1 Verify new project by typing this in and hitting enter. ls lists the contents of a directory showing all files inc hidden ones, hence the -all option.

ls –all

If you see purpleblue_com listed, then change directory to it.

cd purpleblue_com

and verify you can see 4 .py files – init, manage, settings & urls. Those are Django new project default install files.

6. Now we create a wsgi file for the site so apache knows how to run this site.

sudo mkdir /var/www/purpleblue_com/apache
sudo nano /var/www/purpleblue_com/apache/django.wsgi

… and add this into django.wsgi

import os
import sys

path = '/var/www/purpleblue_com'
if path not in sys.path:
    sys.path.insert(0, '/var/www/purpleblue_com')

os.environ['DJANGO_SETTINGS_MODULE'] = 'purpleblue_com.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

TIP: It’s always a good idea to specify the actual application module.

6. Using webmin (ref our LAMP install) setup new apache site for this project.

6.1 Go to: https://YOUR_DEV_VM_IP:10000/
6.2 Servers > Apache Webserver > Create virtual host
6.3 Configure your new host
Document Root = /var/www/purpleblue_com/
Server Name = purpleblue.com
6.4 Click on “Create Now” button. And go back into the settings by clicking on “Virtual Server” button next to your new host.
6.4 Click on “Edit Directives” and paste the following in:

ServerName purpleblue.com
DocumentRoot /var/www/purpleblue_com

<Directory /var/www/purpleblue_com>
    Order allow,deny
    Allow from all
</Directory>

WSGIDaemonProcess purpleblue_com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup purpleblue_com

WSGIScriptAlias / /var/www/purpleblue_com/apache/django.wsgi

The last 3 lines above allow this Django site to run in daemon mode.

TIP: When you make any .py changes in your Django site, rather then restarting/refreshing apache you can touch this wsgi and the changes will be picked up.

sudo touch /var/www/purpleblue_com/apache/django.wsgi

7. Restart apache to take new site & settings into effect.

sudo /etc/init.d/apache2 restart

8. Add the new domain purpleblue.com to your primary OS host file pointing to your VM where the Django project purpleblue_com resides.

9. Test your new project by going to the Server Name (http://purpleblue.com) you just setup. You should see a similar default Django installation page:

It worked! Congratulations on your first Django-powered page.

If you get an error or cannot see the default Django installation page make sure you check out apache log file. Common approach is to grab the tail end of the apache error log file to see what just happened.

tail /var/log/apache2/error.log

Bonus – Django CMS

If you have the time also check out Django CMS that is built on top of the Django Web Framework.

Django CMS site: https://www.django-cms.org/

Happy Django exploring & Python coding!

References