I want to learn to code Python and Django (web framework). What's the best way to start for...

Quora Feeds

Active Member
Matthias Hager

Although I think Python is a better overall language, if you just want to slap a utilitarian web interface on some backend code for internal use then PHP might be a better language to learn. It's easier to setup on the server, will run on virtually any host, and is a more out of the box solution.

As for Python/Django:

If you have never programmed before, it's definitely worth learning Python before you get to Django. Someone with experience could skip to a Django book/tutorial and pickup Python on the way - it's a simple language with very clear, easy to read and understand code.

How long it takes you to learn what you need to know is highly variable. If you are just trying to write some automation scripts to help cut down some manual labor, then you can probably go from zero to this point in a few weeks (maybe 20-30 hours). If you want to write production quality web apps using Python/Django, it's going to take longer.

Setup The Environment

First download Python if you don't have it. http://www.python.org/getit/ I prefer Linux, but your MacBook will be more than sufficient as a dev machine.

Python is in a state of limbo between the 2.7 release version and 3. While 3 is the future, it introduces some intrinsic changes which many of the popular libraries do not yet support, Django included. Your best bet is to start with 2.7 and switch to Python 3 later. Also, most of the learning material available is still written for Python 2.

You can write code in any text editor. My favorite, and an up-and-coming basic code editor is Sublime Text. It is simple, elegant, and very functional. http://www.sublimetext.com/ It costs $59, but you can use it free for an unlimited amount of time (as of right now). Well worth buying though.

Many Mac developers love and swear by TextMate. It's more developed and further along than Sublime, I think. Costs $54, and has a 30-day trial.

If you get deeper into programming and want a full featured integrated development environment (IDE), then PyCharm is top notch. http://www.jetbrains.com/pycharm/ It costs $99 and has a yearly renewal fee for updates, but is worth it. Something like this has a much steeper learning curve than Sublime Text or TextMate, but they can save you time and keystrokes in the long run.

I'm going to assume you are familiar with working in the terminal, since you have IT experience. If not, this might be a good starting point: http://smokingapples.com/softwar...

Django apps can be run entirely on your own dev machine, but if you want to put it on the web to be accessed by others on your team, or from other machines you will need a host. There are some good questions on Quora about hosts, but ensure you choose one that allows Python and SSH access. I recommend finding a cheap Virtual Private Server (VPS), although this might be too steep a learning curve for someone without experience. (You say you've done a lot in the IT field, so some of this might be too basic for you, sorry).

I recommend learning and using Source Control. This helps manage your code revisions, and is particularly useful if you have more than one person working on it. I personally use Mercurial, but Git is more popular.

http://hginit.com/ is a good intro guide for Mercurial. http://learn.github.com/p/intro.... looks to be good for Git, but I haven't worked through it yet.

In addition to using Source Control, you'll need a source code repository (you'll learn what this means in one of those tutorials. GitHub (http://www.github.com) is the most popular, with BitBucket (http://www.bitbucket.org) coming in second. You can use Git on either, but GitHub does not support Mercurial. Also, BB has better options for free accounts - unlimited free repos, whereas GitHub limits you.

You might feel overwhelmed trying to learn how to program Python, learning Django, and trying to figure out source control and a myriad of tools all at once. In my opinion it's best to get down a version control workflow early on, rather than putting it off. You'll develop good habits early on that will help you down the stretch.

Where to Learn
There are a ton of resources for learning Python, and quite a few for Django. Be sure that whatever you choose, you go with resources that consistently use either Python 2 or 3. Also, stay away from small tutorials and stick with complete references. Learning from piecemeal tutorials will leave you with fragmented knowledge, and they are usually lower quality.

Here is a list of references taken from another Quora question. The key to learning how to program, in my opinion, is to practice a lot. So do the exercises these books contain, and do more programming on your own.

Online Tutorials & Ebooks
All free

Recommended: http://www.diveintopython.net/
http://docs.python.org/tutorial/
http://swaroopch.com/notes/Python
http://homepage.mac.com/s_lott/b...
Recommended: http://greenteapress.com/thinkpy... (A higher level look at programming with Python as the tool; highly recommended if you want to be a good programmer)
http://python.net/~goodger/proje...
http://learnpythonthehardway.com/

Videos

http://code.google.com/edu/langu...
http://www.youtube.com/user/then...
Recommended: http://ocw.mit.edu/courses/elect... (A higher level look at programming with Python as the tool; highly recommended if you want to be a good programmer)

Books
Sometimes having a physical book makes it easier for some people to learn. Many of the above ebooks are available in hard copy.

Dive Into Python
Think Python
Learn Python the Hard Way
A Byte of Python

How do I learn Python?

All of those are Python references. The online material available for Django is more sparse, but there are some good resources.

The Django Book is the starting point for most people: http://www.djangobook.com/

There is, of course, the official tutorial: https://docs.djangoproject.com/e... I found Django Book more useful. However, get very familiar with the Django docs. They are very good, and you will be spending a lot of time digging into them.

This is a highly recommended hardcopy book for learning, but I've not used it: https://www.packtpub.com/django-...

Prefer video? This series ought to be very good: http://teamtreehouse.com/library... I have not tried it yet either. There is a $25/mo fee for their service

Getting Assistance
Inevitably, when you are learning or attempting to build something, you're going to run into a brick wall at some point.

This is my workflow if I get stuck on a concept, or while programming:
Check the Documentation -> Check the Source Code -> Search Google -> Ask on StackOverflow

Asking is always a last resort, quite simply because figuring it out on my own gives more of a sense of pride and accomplishment, and I'm more likely to remember the solution.

Python Docs: http://docs.python.org/
Django Docs: https://docs.djangoproject.com/e...

See Questions On Quora

Continue reading...
 
Similar threads
Thread starter Title Forum Replies Date
N Study Buddy need someone to learn python together(beginner) Study Buddy 0
R Study Buddy Learn Python together Study Buddy 1
D PYTHON Q&A 0

Similar threads

Top