forked from mattmakai/fullstackpython.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall.html
5615 lines (5578 loc) · 290 KB
/
all.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Matt Makai">
<link rel="shortcut icon" href="theme/img/fsp-fav.png">
<title>Full Stack Python</title>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<link href="theme/css/f.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet">
<style>
.toc-indent {padding-left: 25px;}
.toc-more-indent {padding-left: 37px;}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-19910497-7', 'auto');
ga('send', 'pageview');
</script> </head>
<body>
<a href="https://github.com/makaimc/fullstackpython.github.com"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png"></a>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="logo-header-section">
<a href="/" style="text-decoration: none; border: none;"><img src="theme/img/fsp-logo.png" height="52" width="52" class="logo-image" style="padding-top: 1px;" alt="Full Stack Python logo"></a>
<span class="logo-title"><a href="/">Full Stack Python</a></span>
</div>
</div>
</div><div class="row">
<div class="col-md-8">
<h1>Introduction</h1>
<p>You're knee deep in learning the <a href="http://www.python.org/">Python</a>
programming language. The syntax is starting to make sense. The first
few "<em>ahh-ha</em>!" moments are hitting you as you're learning conditional
statements, for loops and classes while playing around with the open source
libraries that make Python such an amazing language.</p>
<p>Now you want to take your initial Python knowledge and make something real.
A real web application that's available on the web which you can show off or
sell as a service to other people. That's where Full Stack Python comes in.
You've come to the right place to learn everything you need to deploy and
run a production Python web application.</p>
<p>This guide branches out on topic because your learning needs depend on what
you're currently trying to do. </p>
<h3>Let's get started. What do you need to do right now?</h3>
<h1>Why Use Python?</h1>
<p>Python's expansive library of open source data analysis tools,
<a href="/web-frameworks.html">web frameworks</a>,
and testing instruments make its ecosystem one of the largest out of any
programming community. </p>
<p>Python is an accessible language for new programmers because of the extensive
availability of
<a href="/best-python-resources.html">free and low cost introductory resources</a>. The
language is also widely taught in universities and used for working with
beginner-friendly devices such as the
<a href="http://www.raspberrypi.org/">Raspberry Pi</a>.</p>
<div class="well">
If you're learning about why to use Python you should also take a look at
<a href="/best-python-resources.html">the best Python resources</a> and read
<a href="/what-full-stack-means.html">what "full stack" means</a>.
</div>
<h2>Python's programming language popularity</h2>
<p>Several programming language popularity rankings exist. While it's
possible to criticize that these guides are not exact, every ranking shows
Python as a top programming language within the top ten, if not the top five
of all languages. </p>
<p>Most recently, the
<a href="http://redmonk.com/sogrady/2015/01/14/language-rankings-1-15/">RedMonk January 2015 ranking</a> had Python at #4.</p>
<p>The
<a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE Index</a>,
a long-running language ranking, has Python steady at #8. </p>
<p>The <a href="http://pypl.github.io/PYPL.html">PopularitY of Programming Language</a>
(PYPL), based on leading indicators from Google Trends search keyword
analysis, shows Python at #3.</p>
<p><a href="http://githut.info/">GitHut</a>, a visualization of GitHub language popularity,
pegs Python at #3 overall as well.</p>
<p>These rankings provide a rough measure for language popularity. They are not
intended as a precise measurement tool to determine exactly how many
developers are using a language. However, the aggregate view shows that Python
remains a stable programming language with a growing ecosystem.</p>
<h2>Why does the choice of programming language matter?</h2>
<p>Programming languages have unique ecosystems, cultures and philosophies
built around them. You will find friction with a community and difficulty
in learning if your approach to programming varies from the philosophy of
the programming language you've selected.</p>
<p>Python's culture values
<a href="https://github.com/trending?l=python&since=monthly">open source software</a>,
community involvement with
<a href="http://www.pycon.org/">local, national and international events</a> and
teaching to new programmers. If those values are also important to you and/or
your organization then Python may be a good fit. </p>
<p>The philosophy for Python is so strongly held that it's even embedded in
the language as shown when the interpreter executes "import this" and
displays <a href="https://www.python.org/dev/peps/pep-0020/">The Zen of Python</a>.</p>
<div class="codehilite"><pre><span class="o">>>></span> <span class="n">import</span> <span class="n">this</span>
<span class="n">The</span> <span class="n">Zen</span> <span class="n">of</span> <span class="n">Python</span><span class="p">,</span> <span class="n">by</span> <span class="n">Tim</span> <span class="n">Peters</span>
<span class="n">Beautiful</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">ugly</span><span class="p">.</span>
<span class="n">Explicit</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">implicit</span><span class="p">.</span>
<span class="n">Simple</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">complex</span><span class="p">.</span>
<span class="n">Complex</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">complicated</span><span class="p">.</span>
<span class="n">Flat</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">nested</span><span class="p">.</span>
<span class="n">Sparse</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">dense</span><span class="p">.</span>
<span class="n">Readability</span> <span class="n">counts</span><span class="p">.</span>
<span class="n">Special</span> <span class="n">cases</span> <span class="n">aren</span><span class="err">'</span><span class="n">t</span> <span class="n">special</span> <span class="n">enough</span> <span class="n">to</span> <span class="k">break</span> <span class="n">the</span> <span class="n">rules</span><span class="p">.</span>
<span class="n">Although</span> <span class="n">practicality</span> <span class="n">beats</span> <span class="n">purity</span><span class="p">.</span>
<span class="n">Errors</span> <span class="n">should</span> <span class="n">never</span> <span class="n">pass</span> <span class="n">silently</span><span class="p">.</span>
<span class="n">Unless</span> <span class="n">explicitly</span> <span class="n">silenced</span><span class="p">.</span>
<span class="n">In</span> <span class="n">the</span> <span class="n">face</span> <span class="n">of</span> <span class="n">ambiguity</span><span class="p">,</span> <span class="n">refuse</span> <span class="n">the</span> <span class="n">temptation</span> <span class="n">to</span> <span class="n">guess</span><span class="p">.</span>
<span class="n">There</span> <span class="n">should</span> <span class="n">be</span> <span class="n">one</span><span class="o">--</span> <span class="n">and</span> <span class="n">preferably</span> <span class="n">only</span> <span class="n">one</span> <span class="o">--</span><span class="n">obvious</span> <span class="n">way</span> <span class="n">to</span> <span class="k">do</span> <span class="n">it</span><span class="p">.</span>
<span class="n">Although</span> <span class="n">that</span> <span class="n">way</span> <span class="n">may</span> <span class="n">not</span> <span class="n">be</span> <span class="n">obvious</span> <span class="n">at</span> <span class="n">first</span> <span class="n">unless</span> <span class="n">you</span><span class="err">'</span><span class="n">re</span> <span class="n">Dutch</span><span class="p">.</span>
<span class="n">Now</span> <span class="n">is</span> <span class="n">better</span> <span class="n">than</span> <span class="n">never</span><span class="p">.</span>
<span class="n">Although</span> <span class="n">never</span> <span class="n">is</span> <span class="n">often</span> <span class="n">better</span> <span class="n">than</span> <span class="o">*</span><span class="n">right</span><span class="o">*</span> <span class="n">now</span><span class="p">.</span>
<span class="n">If</span> <span class="n">the</span> <span class="n">implementation</span> <span class="n">is</span> <span class="n">hard</span> <span class="n">to</span> <span class="n">explain</span><span class="p">,</span> <span class="n">it</span><span class="err">'</span><span class="n">s</span> <span class="n">a</span> <span class="n">bad</span> <span class="n">idea</span><span class="p">.</span>
<span class="n">If</span> <span class="n">the</span> <span class="n">implementation</span> <span class="n">is</span> <span class="n">easy</span> <span class="n">to</span> <span class="n">explain</span><span class="p">,</span> <span class="n">it</span> <span class="n">may</span> <span class="n">be</span> <span class="n">a</span> <span class="n">good</span> <span class="n">idea</span><span class="p">.</span>
<span class="n">Namespaces</span> <span class="n">are</span> <span class="n">one</span> <span class="n">honking</span> <span class="n">great</span> <span class="n">idea</span> <span class="o">--</span> <span class="n">let</span><span class="err">'</span><span class="n">s</span> <span class="k">do</span> <span class="n">more</span> <span class="n">of</span> <span class="n">those</span><span class="o">!</span>
</pre></div>
<h3>More perspectives on why to use Python</h3>
<ul>
<li>
<p>The Python documentation has a HOWTO section specifically for
<a href="https://docs.python.org/2/howto/advocacy.html">Python advocacy</a>.</p>
</li>
<li>
<p><a href="http://nothingbutsnark.svbtle.com/how-to-argue-for-pythons-use">How to argue for Python’s use</a>
explains that choosing a programming language can be complicated but that
Python is a very good option for many use cases.</p>
</li>
<li>
<p><a href="http://lorenabarba.com/blog/why-i-push-for-python/">Why I Push for Python</a>
explains one professor's rationale for promoting Python to teach programming
to undergraduates.</p>
</li>
</ul>
<h3>Resources for Python enterprise advocacy</h3>
<ul>
<li>
<p>CIO Magazine discusses why
<a href="http://www.cio.com/article/2431212/developer/dynamic-languages--not-just-for-scripting-any-more.html">dynamic languages are increasingly being adopted in enterprise environments</a>.</p>
</li>
<li>
<p>PayPal covers
<a href="https://www.paypal-engineering.com/2014/12/10/10-myths-of-enterprise-python/">10 myths about enterprise Python</a>
via their engineering blog.</p>
</li>
<li>
<p>My DjangoCon 2014 talk focused on overcoming false biases against
<a href="https://www.youtube.com/watch?v=aMtiCX38w20">Python and Django in enterprise environments</a>.</p>
</li>
</ul>
<h2>What else would you like to know about Python?</h2>
<h1>Best Python Resources</h1>
<p>The Python community is amazing at sharing detailed resources and helping
beginners learn to program with the language. There are so many resources
out there though that it can be difficult to know how to find them. </p>
<p>This page aggregates the best general Python resources with descriptions of
what they provide to readers.</p>
<div class="well" style="margin-top: 20px;">
If you prefer learning by watching videos
<a href="/best-python-videos.html">best Python videos</a> as well
as a read what
<a href="/development-environments.html">development environments</a>
to use for coding.
</div>
<h2>New to programming</h2>
<p>If you're learning your first programming language these books were written
with you in mind. Developers learning Python as a second or later language
should skip down to the next section for "experienced developers".</p>
<ul>
<li>
<p>To get an introduction to Python, Django and Flask at the same time,
consider purchasing the
<a href="https://www.realpython.com/?utm_source=fsp&utm_medium=promo&utm_campaign=bestresources" onclick="trackOutboundLink('https://www.realpython.com/?utm_source=fsp&utm_medium=promo&utm_campaign=bestresources'); return false;">Real Python</a>
course by Fletcher, Michael and Jeremy.</p>
</li>
<li>
<p>If you've never programmed before check out the
<a href="http://learntocodewith.me/getting-started/">Getting Started</a> page on
<a href="http://learntocodewith.me/">Learn To Code with Me</a>
by <a href="https://twitter.com/lebdev">Laurence Bradford</a>. She's done an
incredible job of breaking down the steps beginners should take when
they're uncertain about where to begin.</p>
</li>
<li>
<p><a href="http://learnpythonthehardway.org/book/">Learn Python the Hard Way</a> is a
free book by Zed Shaw.</p>
</li>
<li>
<p><a href="http://www.diveinto.org/python3/">Dive into Python 3</a> is an open source
book provided under the Creative Commons license and available in HTML or
PDF form.</p>
</li>
<li>
<p><a href="http://pymbook.readthedocs.org/en/latest/">Python for You and Me</a> (pym) is
an online book for people completely unfamiliar with the Python programming
language.</p>
</li>
<li>
<p><a href="http://www.swaroopch.com/notes/python/">A Byte of Python</a> is a beginner's
tutorial for the Python language. </p>
</li>
<li>
<p>Code Academy has a <a href="http://www.codecademy.com/tracks/python">Python track</a>
for people completely new to programming.</p>
</li>
<li>
<p><a href="http://opentechschool.github.io/python-beginners/en/index.html">Introduction to Programming with Python</a>
goes over the basic syntax and control structures in Python. The free book
has numerous code examples to go along with each topic.</p>
</li>
<li>
<p>The O'Reilly book
<a href="http://greenteapress.com/thinkpython/html/index.html">Think Python: How to Think Like a Computer Scientist</a>
is available in HTML form for free on the web.</p>
</li>
<li>
<p><a href="http://anandology.com/python-practice-book/index.html">Python Practice Book</a>
is a book of Python exercises to help you learn the basic language syntax.</p>
</li>
<li>
<p>Looking for ideas about what projects to use to learn to code? Check out
<a href="https://medium.com/learning-journalism-tech/five-mini-programming-projects-for-the-python-beginner-21492f6ce0f3">this list of 5 programming project for Python beginners</a>.</p>
</li>
<li>
<p>I wrote a quick blog post on
<a href="http://www.mattmakai.com/learning-python-for-non-developers.html">learning Python</a>
that non-technical folks trying to learn to program may find useful.</p>
</li>
</ul>
<h2>Experienced developers new to Python</h2>
<ul>
<li>
<p><a href="http://learnxinyminutes.com/docs/python/">Learn Python in y minutes</a>
provides a whirlwind tour of the Python language. The guide is especially
useful if you're coming in with previous software development experience
and want to quickly grasp how the language is structured.</p>
</li>
<li>
<p><a href="http://pymbook.readthedocs.org/en/latest/">Python for you and me</a> is an
approachable book with sections for Python syntax and the major language
constructs. The book also contains a short guide at the end to get
programmers to write their first Flask web application.</p>
</li>
<li>
<p>Kenneth Reitz's
<a href="http://docs.python-guide.org/en/latest/">The Hitchhiker’s Guide to Python</a>
contains a wealth of information both on the Python programming language and the community.</p>
</li>
<li>
<p><a href="https://districtdatalabs.silvrback.com/how-to-develop-quality-python-code">How to Develop Quality Python Code</a>
is a good read to begin learning about development environments,
application dependencies and project structure.</p>
</li>
</ul>
<h2>Beyond the basics</h2>
<ul>
<li>
<p><a href="http://mirnazim.org/writings/python-ecosystem-introduction/">The Python Ecosystem: An Introduction</a>
provides context for virtual machines, Python packaging, pip, virutalenv
and many other topics after learning the basic Python syntax. </p>
</li>
<li>
<p>The <a href="http://www.reddit.com/r/python">Python Subreddit</a> rolls up great
Python links and has an active community ready to answer questions from
beginners and advanced Python developers alike.</p>
</li>
<li>
<p><a href="http://jessenoller.com/good-to-great-python-reads/">Good to Great Python Reads</a>
is a collection of intermediate and advanced Python articles around the web
focused on nuances and details of the Python language itself.</p>
</li>
<li>
<p>The blog <a href="http://freepythontips.wordpress.com/">Free Python Tips</a> provides
posts on Python topics as well as news for the Python ecosystem.</p>
</li>
<li>
<p><a href="http://pythonbooks.revolunet.com/">Python Books</a> is a collection of freely
available books on Python, Django, and data analysis.</p>
</li>
</ul>
<h2>Videos, screencasts and presentations</h2>
<p>Videos from conferences and meetups along with screencasts are listed on
the <a href="/best-python-videos.html">best Python videos</a> page.</p>
<h2>Curated Python packages lists</h2>
<ul>
<li>
<p><a href="https://github.com/vinta/awesome-python">awesome-python</a> is an incredible
list of Python frameworks, libraries and software. I wish I had this
page when I was just getting started. </p>
</li>
<li>
<p><a href="http://easy-python.readthedocs.org/en/latest/">easy-python</a> is like
awesome-python although instead of just a Git repository this site is
in the Read the Docs format.</p>
</li>
</ul>
<h2>Newsletters</h2>
<ul>
<li>
<p><a href="http://www.pythonweekly.com/">Python Weekly</a> is a free weekly roundup
of the latest Python articles, videos, projects and upcoming events.</p>
</li>
<li>
<p><a href="http://pycoders.com/">PyCoder's Weekly</a> is another great free weekly
email newsletter similar to Python Weekly. The best resources are generally
covered in both newsletters but they often cover different articles
and projects from around the web.</p>
</li>
<li>
<p><a href="http://importpython.com/newsletter/">Import Python</a> is a newer newsletter
thank Python Weekly and PyCoder's Weekly. So far I've found this newsletter
covers different sources from other newsletters. It's well worth subscribing
to all three so you don't miss anything.</p>
</li>
</ul>
<h3>Those resources should help get you started. What's next?</h3>
<h1>Best Python Videos</h1>
<p>If you prefer to learn Python programming by watching videos then this is the
resource for you. I've watched hundreds of live technical talks and combed
through videos to pick out the ones with great speakers who'll teach you the
most about the language and ecosystem. </p>
<p>This page links to the best free videos as well as other video lists so you
can do your own searching through the huge backlog of conference and meetup
talks from the past several years. </p>
<div class="well" style="margin-top: 20px;">
Be sure to read the
<a href="/best-python-resources.html">best Python resources</a> for
links to books and articles as well as
<a href="/web-frameworks.html">web frameworks</a>
to learn more about web development.
</div>
<h2>Web development with Django, Flask and other frameworks</h2>
<ul>
<li>
<p><a href="https://twitter.com/heddle317">Kate Heddleston</a> gave a talk at PyCon 2014
called
"<a href="http://pyvideo.org/video/2591/so-you-want-to-be-a-full-stack-developer-how-to">Full-stack Python Web Applications</a>"
with clear visuals for how numerous layers of the Python web
stack fit together. There are also <a href="https://speakerdeck.com/pycon2014/so-you-want-to-be-a-full-stack-developer-how-to-build-a-full-stack-python-web-application-by-kate-heddleston">slides available from the talk</a>
with all the diagrams.</p>
</li>
<li>
<p>My <a href="https://www.youtube.com/watch?v=s6NaOKD40rY">EuroPython 2014 "Full Stack Python"</a>
talk goes over each topic from this guide and provides context for how the
pieces fit together.
The <a href="http://www.mattmakai.com/presentations/2014-full-stack-python-berlin.html">talk slides</a> are also available.</p>
</li>
<li>
<p>Kate Heddleston and I gave a talk at DjangoCon 2014 called
<a href="https://www.youtube.com/watch?v=QrFEKghISEI">Choose Your Own Django Deployment Adventure</a>
which walked through many of the scenarios you'd face when deploying your
first Django website.</p>
</li>
<li>
<p>The <a href="https://github.com/realpython/discover-flask">Discover Flask</a> series is
a detailed Flask tutorial on video with corresponding code examples on
GitHub.</p>
</li>
<li>
<p><a href="http://pyvideo.org/video/2630/designing-djangos-migrations">Designing Django's Migrations</a>
covers Django 1.7's new migrations from the main programmer
of South and now Django's built-in migrations, Andrew Godwin.</p>
</li>
<li>
<p><a href="https://godjango.com/">GoDjango</a> screencasts and tutorials are free short
videos for learning how to build Django applications.</p>
</li>
<li>
<p><a href="http://gettingstartedwithdjango.com/">Getting Started with Django</a> is a
series of video tutorials for the framework.</p>
</li>
<li>
<p>The videos and slides from
<a href="http://www.djangounderthehood.com/talks/">Django: Under the Hood 2014</a>
are from Django core commiters and provide insight into the ORM,
internationalization, templates and other topics.</p>
</li>
<li>
<p>DjangoCon US videos from
<a href="https://www.youtube.com/playlist?list=PLE7tQUdRKcybbNiuhLcc3h6WzmZGVBMr3">2014</a>,
<a href="http://www.youtube.com/user/TheOpenBastion/videos">2013</a>,
<a href="http://pyvideo.org/category/23/djangocon-2012">2012</a>,
<a href="http://pyvideo.org/category/3/djangocon-2011">2011</a>, as well as<br />
<a href="http://pyvideo.org/category">earlier US and DjangoCon EU conferences</a> are
all available free of charge.</p>
</li>
</ul>
<h2>Core Python language videos</h2>
<ul>
<li>
<p>Jessica McKellar's
<a href="https://www.youtube.com/watch?v=sL_syMmRkoU">Building and breaking a Python sandbox</a>
is a fascinating walk through the lower layers of the Python interpreter.</p>
</li>
<li>
<p>Brandon Rhodes'
<a href="https://www.youtube.com/watch?v=fYlnfvKVDoM">All Your Ducks In A Row: Data Structures in the Std Lib and Beyond</a>
goes through how data structures are implemented, how to select a
data structure appropriate to your application and how the list and
dictionary can be used in many situations.</p>
</li>
</ul>
<h2>Screencasts and class recordings</h2>
<ul>
<li>
<p><a href="https://www.neckbeardrepublic.com/">Neckbeard Republic</a> provides free
screencasts for learning intermediate topics. I typically prefer to learn
by reading. However, these videos are helpful in seeing the code on the
screen instead of just looking at static code snippets.</p>
</li>
<li>
<p><a href="https://developers.google.com/edu/python/">Google's Python Class</a> contains
lecture videos and exercises for learning Python.</p>
</li>
</ul>
<h2>Video compilations</h2>
<ul>
<li>
<p><a href="http://www.pyvideo.org/">PyVideo</a> organizes and indexes thousands of Python
videos from both major conferences and meetups.</p>
</li>
<li>
<p><a href="https://github.com/makaimc/incredible-technical-speakers">Incredible Technical Speakers</a>
is a repository I put together that features software developer speakers
talking about programming language agnostic topics. The list is intended
to emphasize professional software developers who also have the ability to
engage an audience of peers with an exciting talk.</p>
</li>
</ul>
<h3>What's next after watching Python videos?</h3>
<h1>Development Environments</h1>
<p>A development environment is a combination of a text editor and the Python
interpreter. The text editor allows you to write the code. The interpreter
provides a way to execute the code you've written. A text editor can be
as simple as Notepad on Windows or more complicated as a complete integrated
development environment (IDE) such as
<a href="https://www.jetbrains.com/pycharm/">PyCharm</a> which runs on any major
operating system.</p>
<h2>Why is a development environment necessary?</h2>
<p>Python code needs to be written, executed and tested to build
applications. The text editor provides a way to write the code. The
interpreter allows it to be executed. Testing to see if the code does what
you want can either be done manually or by unit and functional tests. </p>
<h2>A development environment example</h2>
<p>Here's what I (the author of Full Stack Python,
<a href="/about-author.html">Matt Makai</a>) use to develop most of my Python
applications. I have a Macbook Pro with Mac OS X as its base operating
system. <a href="/operating-systems.html">Ubuntu 14.04 LTS</a> is virtualized on top
with <a href="https://www.parallels.com/">Parallels</a>. My code is written in
<a href="http://www.vim.org/">vim</a> and executed with the
<a href="https://www.python.org/download/releases/2.7.8/">Python 2.7.x</a> interpreter
via the command line. I use virtualenv to create separate Python interpreters
with their own isolated
<a href="/application-dependencies.html">application dependencies</a> and
<a href="http://virtualenvwrapper.readthedocs.org/en/latest/">virtualenvwrapper</a>
to quickly switch between the interpreters created by virtualenv.</p>
<p>That's a common set up but you can certainly write great code with a much
less expensive set up or a cloud-based development environment.</p>
<h2>Open source development environments</h2>
<ul>
<li>
<p><a href="http://www.vim.org/">vim</a> is my editor of choice and installed by default
on most *nix systems.</p>
</li>
<li>
<p><a href="http://www.gnu.org/software/emacs/">emacs</a> is another editor often used
on *nix.</p>
</li>
<li>
<p><a href="http://pydev.org/">PyDev</a> is a Python IDE plug in for
<a href="https://www.eclipse.org/">Eclipse</a>.</p>
</li>
<li>
<p><a href="http://www.sublimetext.com/">Sublime Text</a> versions 2 and 3 (currently
in beta) are popular text editors that can be extended with code completion,
linting, syntax highlighting and other features using plugins.</p>
</li>
<li>
<p><a href="https://atom.io/">Atom</a> is an open source editor built by the
<a href="https://github.com">GitHub</a> team.</p>
</li>
</ul>
<h2>Python-specific IDEs</h2>
<ul>
<li>
<p><a href="https://www.jetbrains.com/pycharm/">PyCharm</a> is a Python-specific IDE
built on <a href="https://www.jetbrains.com/">JetBrains</a>' platform. There are
free editions for students and open source projects.</p>
</li>
<li>
<p><a href="https://wingware.com/">Wing IDE</a> is a paid development environment with
integrated debugging and code completion.</p>
</li>
<li>
<p><a href="http://komodoide.com/">Komodo</a></p>
</li>
</ul>
<h2>Hosted development environment services</h2>
<p>In the past couple of years several cloud-based development environments
have popped up. These can work great for when you're learning or stuck on
a machine with only a browser but no way to install your own software. Most
of these have free tiers for getting started and paid tiers as you scale
up your application.</p>
<ul>
<li>
<p><a href="https://www.nitrous.io/">Nitrous.io</a></p>
</li>
<li>
<p><a href="https://c9.io/">Cloud9</a></p>
</li>
<li>
<p><a href="https://www.terminal.com/">Terminal</a></p>
</li>
<li>
<p><a href="https://koding.com/">Koding</a></p>
</li>
</ul>
<h2>Development environment resources</h2>
<ul>
<li>
<p>If you're considering the cloud-based development environment route, check
out this
<a href="http://readwrite.com/2014/08/14/cloud9-koding-nitrousio-integrated-development-environment-ide-coding">great article comparing Cloud9, Koding and Nitrous.io</a>
by Lauren Orsini. She also explains more about what a cloud IDE is and is
not.</p>
</li>
<li>
<p>Real Python has an awesome, detailed post on
<a href="https://realpython.com/blog/python/setting-up-sublime-text-3-for-full-stack-python-development/">setting up your Sublime Text 3 environment</a>
as a full-fledged IDE.</p>
</li>
<li>
<p>The <a href="http://docs.python-guide.org/en/latest/dev/env/">Hitchhiker's Guide to Python</a>
has a page dedicated to development environments.</p>
</li>
<li>
<p><a href="http://pedrokroger.net/choosing-best-python-ide/">Choosing the best Python IDE</a>
is a review of six IDEs. PyCharm, Wing IDE and PyDev stand out above the
other three in this review.</p>
</li>
<li>
<p><a href="http://nafiulis.me/pycharm-the-good-parts-i.html">PyCharm: The Good Parts</a>
shows you how to be more efficient and productive with that IDE if it's
your choice for writing Python code.</p>
</li>
</ul>
<h1>Vim</h1>
<p>Vim, shorthand for Vi IMproved, is a text editor with numerous configuration
options and wide-ranging extensions that can be used to write Python code.</p>
<h2>Why is Vim a good Python development environment?</h2>
<p>Vim's philosophy is that developers are fastest when they never take their
hands off the keys. Even using the mouse is a detriment to the rate at which
your thoughts can flow into code. </p>
<p>Vim has a language behind its commands. When a beginner is learning the
editor she may feel like it is impossible to understand all the key commands.
However, the commands stack together in a logical way so that over time
the editor becomes predictable.</p>
<h2>Configuring Vim with a Vimrc</h2>
<p>The Vimrc file is used to configure the Vim editor. A Vimrc file can range
from nothing in it to very complicated with hundreds or thousands of lines
of configuration commands.</p>
<p>Here's a simple example .vimrc file I use for Python development to get a feel
for some of the configuration statements:</p>
<div class="codehilite"><pre><span class="cp"># enable syntax highlighting</span>
<span class="n">syntax</span> <span class="n">on</span>
<span class="cp"># the next 4 lines set tabs to have 4 spaces, autoindent when already</span>
<span class="cp"># working with indented lines, expand tabs key presses to spaces and</span>
<span class="cp"># move lines 4 spaces each time the >> or << commands are used</span>
<span class="n">set</span> <span class="n">ts</span><span class="o">=</span><span class="mi">4</span>
<span class="n">set</span> <span class="n">autoindent</span>
<span class="n">set</span> <span class="n">expandtab</span>
<span class="n">set</span> <span class="n">shiftwidth</span><span class="o">=</span><span class="mi">4</span>
<span class="cp"># enable all Python syntax highlighting features</span>
<span class="n">let</span> <span class="n">python_highlight_all</span> <span class="o">=</span> <span class="mi">1</span>
</pre></div>
<p>The Vimrc file lives under the home directory of the user account running
Vim. For example, when my user account is 'matt', on Mac OS X my Vimrc
file is found at <code>/Users/matt/.vimrc</code>. On Ubuntu Linux my Vimrc file
can be found within <code>/home/matt/.vimrc</code>. </p>
<p>If the Vimrc file does not already exist, just create it within the user's
home directory and it will be picked up by Vim the next time you start the
program.</p>
<h2>General Vim resources</h2>
<ul>
<li>
<p><a href="http://vim-adventures.com/">Vim Adventures</a> is a cute, fun browser-based
game that helps you learn Vim commands by playing through the adventure.</p>
</li>
<li>
<p><a href="http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/">Learn Vim Progressively</a>
is a wonderful tutorial that follows the path I took when learning Vim:
learn just enough to survive with it as your day-to-day editor then begin
adding more advanced commands on top.</p>
</li>
<li>
<p><a href="https://danielmiessler.com/study/vim/">A vim Tutorial and Primer</a> is an
incredibly deep study in how to go from beginner to knowledgeable in Vim.</p>
</li>
<li>
<p><a href="http://haridas.in/vim-as-your-ide.html">Vim as Your IDE</a> discusses how to
set up Vim for greater productivity once you learn the initial Vim language
for using the editor.</p>
</li>
<li>
<p><a href="http://stackoverflow.com/questions/9172802/setting-up-vim-for-python">Setting up Vim for Python</a>
has a well written answer on Stack Overflow for getting started with Vim.</p>
</li>
<li>
<p><a href="http://benmccormick.org/2014/07/02/learning-vim-in-2014-vim-as-language/">Vim as a Language</a>
explains the language syntax and how you can build up over time to master
the editor.</p>
</li>
<li>
<p>In <a href="http://mislav.uniqpath.com/2011/12/vim-revisited/">Vim: revisited</a> the
author explains his on-again off-again relationship with using Vim. He then
shows how he configures and uses the editor so it sticks as his primary
code editting tool.</p>
</li>
</ul>
<h2>Vimrc resources</h2>
<ul>
<li>
<p><a href="http://dougblack.io/words/a-good-vimrc.html">A Good Vimrc</a> is a fantastic,
detailed overview and opinionated guide to configuring Vim. Highly
recommended for new and experienced Vim users.</p>
</li>
<li>
<p><a href="https://justin.abrah.ms/vim/vim_and_python.html">Vim and Python</a> shows
and explains many Python-specific .vimrc options.</p>
</li>
</ul>
<h3>What do you want to learn about Python development?</h3>
<h1>Emacs</h1>
<p>Emacs is an extensible text editor that can be customized by writing Lisp
code.</p>
<h2>Why is Emacs a good choice for Python coding?</h2>
<p>Emacs is designed to be customized via the built-in Lisp interpreter and
package manager. The package manager, named package.el, has menus for
handling installation. The largest Lisp Package Archive is
<a href="http://melpa.org">Melpa</a>, which provides automatic updates from upstream
sources.</p>
<p>Macros are useful for performing repetitive actions in Emacs. A macro
is just a recording of a previous set of keystrokes that can be replayed
to perform future actions.</p>
<p>Hooks, which are Lisp variables that hold lists of functions to call,
provide an extension mechanism for Emacs. For example,
<code>kill-emacs-hook</code> runs before exiting Emacs so functions can be loaded
into that hook to perform necessary actions before the exiting completes.</p>
<h2>General Emacs resources</h2>
<ul>
<li>
<p><a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html">GNU Emacs Manual</a>
provides an official in-depth review for how to use Emacs.</p>
</li>
<li>
<p><a href="http://emacsredux.com/">Emacs Redux</a> is a blog with tips and tricks for
how to use Emacs effectively.</p>
</li>
<li>
<p><a href="http://emacsrocks.com/">Emacs Rocks</a> is a video tutorial series for Emacs.</p>
</li>
<li>
<p><a href="http://whattheemacsd.com/">What the .emacs.d?!</a> provides a bunch of tiny
optimizations for Emacs' workflow.</p>
</li>
</ul>
<h2>Notable Elisp Packages</h2>
<ul>
<li>
<p><a href="http://magit.github.io/">Magit</a> allows the user to inspect and modify
Git repositories from within Emacs.</p>
</li>
<li>
<p><a href="http://company-mode.github.io/">company-mode</a> creates a modular in-buffer
completion framework.</p>
</li>
<li>
<p><a href="http://flycheck.github.io/">Flycheck</a> provides syntax checking.</p>
</li>
<li>
<p><a href="https://github.com/proofit404/anaconda-mode/">anaconda-mode</a> is specific
to Python development and allows code navigation, documentation lookup
and code completion. The <a href="http://jedi.jedidjah.ch/en/latest/">jedi</a> library
is used under the hood.</p>
</li>
<li>
<p><a href="http://ternjs.net/">Tern</a> is a stand-alone code-analysis engine for
JavaScript. It can be integrated within a Django project
via the <a href="https://github.com/proofit404/tern-django">tern-django</a> package.</p>
</li>
</ul>
<h2>Popular user configurations</h2>
<ul>
<li>
<p><a href="https://github.com/bbatsov/prelude">Prelude</a> is an enhanced Emacs
version 24 distribution.</p>
</li>
<li>
<p><a href="https://github.com/purcell/emacs.d">A reasonable Emacs config</a> shows
a batteries-includes Emacs configuration bundle.</p>
</li>
<li>
<p><a href="https://github.com/magnars/.emacs.d">Emacs settings</a> is a repository of
configurations used in the Emacs Rocks screencasts.</p>
</li>
<li>
<p><a href="https://github.com/syl20bnr/spacemacs">Spacemacs</a> mashes together Emacs'
extensibility and Vim's ergonomic text editing features.</p>
</li>
</ul>
<h3>What's next once your development environment is set up?</h3>
<h1>Generators</h1>
<p>Generators are a Python core language construct that allow a function's return
value to to behave as an iterator. A generator can allow more efficient
memory usage by allocating and allocating during the context of a large
number of iterations. Generators are defined in
<a href="https://www.python.org/dev/peps/pep-0255/">PEP255</a> and included in the
language as of Python 2.2 in 2001.</p>
<h2>Python generator resources</h2>
<ul>
<li>
<p><a href="http://intermediatepythonista.com/python-generators">An introduction to Python generators</a>
by Intermediate Pythonista is a well done post with code examples.</p>
</li>
<li>
<p>This blog post entitled
<a href="http://rdrewd.blogspot.com/2014/02/python-generators.html">Python Generators</a>
specifically focuses on generating dictionaries. It provides a good
introduction for those new to Python.</p>
</li>
<li>
<p><a href="http://www.blog.pythonlibrary.org/2014/01/27/python-201-an-intro-to-generators/">Python 201: An Intro to Generators</a>
is another short but informative read with example generators code.</p>
</li>
<li>
<p><a href="http://anandology.com/python-practice-book/iterators.html">Iterators & Generators</a>
provides code examples for these two constructs and some simple explanations
for each..</p>
</li>
<li>
<p>The question to <a href="http://stackoverflow.com/questions/1756096/understanding-generators-in-python">Understanding Generators in Python?</a>
on Stack Overflow has an impressive answer that clearly lays out the
code and concepts involved with Python generators.</p>
</li>
</ul>
<h3>What's next after learning about generators?</h3>
<h1>Comprehensions</h1>
<p>Comprehensions are a Python language construct for concisely creating data
in lists, dictionaries and sets. List comprehensions are included in Python 2
while dictionary and set comprehensions were introduced to the language in
Python 3.</p>
<h2>Why are comprehensions important?</h2>
<p>Comprehensions are a more clear syntax for populating conditional data in the
core Python data structures. Creating data without comprehensions often
involves nested loops with conditionals that can be difficult for code
readers to properly evaluate.</p>
<h2>Example code</h2>
<p>List comprehension:</p>
<div class="codehilite"><pre><span class="o">>>></span> <span class="n">double_digit_evens</span> <span class="o">=</span> <span class="p">[</span><span class="n">e</span><span class="o">*</span><span class="mi">2</span> <span class="k">for</span> <span class="n">e</span> <span class="n">in</span> <span class="n">range</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">50</span><span class="p">)]</span>
<span class="o">>>></span> <span class="n">double_digit_evens</span>
<span class="p">[</span><span class="mi">10</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">18</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">22</span><span class="p">,</span> <span class="mi">24</span><span class="p">,</span> <span class="mi">26</span><span class="p">,</span> <span class="mi">28</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="mi">34</span><span class="p">,</span> <span class="mi">36</span><span class="p">,</span> <span class="mi">38</span><span class="p">,</span> <span class="mi">40</span><span class="p">,</span> <span class="mi">42</span><span class="p">,</span> <span class="mi">44</span><span class="p">,</span> <span class="mi">46</span><span class="p">,</span> <span class="mi">48</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">52</span><span class="p">,</span> <span class="mi">54</span><span class="p">,</span> <span class="mi">56</span><span class="p">,</span> <span class="mi">58</span><span class="p">,</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">62</span><span class="p">,</span> <span class="mi">64</span><span class="p">,</span> <span class="mi">66</span><span class="p">,</span> <span class="mi">68</span><span class="p">,</span> <span class="mi">70</span><span class="p">,</span> <span class="mi">72</span><span class="p">,</span> <span class="mi">74</span><span class="p">,</span> <span class="mi">76</span><span class="p">,</span> <span class="mi">78</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">82</span><span class="p">,</span> <span class="mi">84</span><span class="p">,</span> <span class="mi">86</span><span class="p">,</span> <span class="mi">88</span><span class="p">,</span> <span class="mi">90</span><span class="p">,</span> <span class="mi">92</span><span class="p">,</span> <span class="mi">94</span><span class="p">,</span> <span class="mi">96</span><span class="p">,</span> <span class="mi">98</span><span class="p">]</span>
</pre></div>
<p>Set comprehension:</p>
<div class="codehilite"><pre><span class="o">>>></span> <span class="n">double_digit_odds</span> <span class="o">=</span> <span class="p">{</span><span class="n">e</span><span class="o">*</span><span class="mi">2</span><span class="o">+</span><span class="mi">1</span> <span class="k">for</span> <span class="n">e</span> <span class="n">in</span> <span class="n">range</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">50</span><span class="p">)}</span>
<span class="p">{</span><span class="mi">11</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">17</span><span class="p">,</span> <span class="mi">19</span><span class="p">,</span> <span class="mi">21</span><span class="p">,</span> <span class="mi">23</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">27</span><span class="p">,</span> <span class="mi">29</span><span class="p">,</span> <span class="mi">31</span><span class="p">,</span> <span class="mi">33</span><span class="p">,</span> <span class="mi">35</span><span class="p">,</span> <span class="mi">37</span><span class="p">,</span> <span class="mi">39</span><span class="p">,</span> <span class="mi">41</span><span class="p">,</span> <span class="mi">43</span><span class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span class="mi">47</span><span class="p">,</span> <span class="mi">49</span><span class="p">,</span> <span class="mi">51</span><span class="p">,</span> <span class="mi">53</span><span class="p">,</span> <span class="mi">55</span><span class="p">,</span> <span class="mi">57</span><span class="p">,</span> <span class="mi">59</span><span class="p">,</span> <span class="mi">61</span><span class="p">,</span> <span class="mi">63</span><span class="p">,</span> <span class="mi">65</span><span class="p">,</span> <span class="mi">67</span><span class="p">,</span> <span class="mi">69</span><span class="p">,</span> <span class="mi">71</span><span class="p">,</span> <span class="mi">73</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">77</span><span class="p">,</span> <span class="mi">79</span><span class="p">,</span> <span class="mi">81</span><span class="p">,</span> <span class="mi">83</span><span class="p">,</span> <span class="mi">85</span><span class="p">,</span> <span class="mi">87</span><span class="p">,</span> <span class="mi">89</span><span class="p">,</span> <span class="mi">91</span><span class="p">,</span> <span class="mi">93</span><span class="p">,</span> <span class="mi">95</span><span class="p">,</span> <span class="mi">97</span><span class="p">,</span> <span class="mi">99</span><span class="p">}</span>
</pre></div>
<p>Dictionary comprehension:</p>
<div class="codehilite"><pre><span class="o">>>></span> <span class="p">{</span><span class="n">e</span><span class="o">:</span> <span class="n">e</span><span class="o">*</span><span class="mi">10</span> <span class="k">for</span> <span class="n">e</span> <span class="n">in</span> <span class="n">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">11</span><span class="p">)}</span>
<span class="p">{</span><span class="mi">1</span><span class="o">:</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">2</span><span class="o">:</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">3</span><span class="o">:</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">4</span><span class="o">:</span> <span class="mi">40</span><span class="p">,</span> <span class="mi">5</span><span class="o">:</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">6</span><span class="o">:</span> <span class="mi">60</span><span class="p">,</span> <span class="mi">7</span><span class="o">:</span> <span class="mi">70</span><span class="p">,</span> <span class="mi">8</span><span class="o">:</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">9</span><span class="o">:</span> <span class="mi">90</span><span class="p">,</span> <span class="mi">10</span><span class="o">:</span> <span class="mi">100</span><span class="p">}</span>
</pre></div>
<h2>Comprehension resources</h2>
<ul>
<li>
<p>Intermediate Python's
<a href="http://intermediatepythonista.com/python-comprehensions">Python Comprehensions</a>
post gives a well written overview of comprehensions for the three core
Python data structures.</p>
</li>
<li>
<p>The Python 3 Patterns and Idioms site has an overview of
<a href="http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Comprehensions.html">comprehensions</a>
including code examples and diagrams to explain how they work.</p>
</li>
<li>
<p><a href="http://blog.cdleary.com/2010/04/learning-python-by-example-list-comprehensions/">Learning Python by example: list comprehensions</a>
gives an example of an incorrect list comprehension then shows how to
correct its issues.</p>
</li>
<li>
<p><a href="http://www.pythonforbeginners.com/basics/list-comprehensions-in-python">List comprehensions in Python</a>
covers what the code for list comprehensions looks like and gives some
example code to show how they work.</p>
</li>
</ul>
<h3>Learn more about data or head back to the intro?</h3>
<h1>Web frameworks</h1>
<p>A web framework is a code library that makes a developer's life easier when
building reliable, scalable and maintainable web applications.</p>
<h2>Why are web frameworks necessary?</h2>
<p>Web frameworks encapsulate what developers have learned over the past twenty
years while programming sites and applications for the web. Frameworks make
it easier to reuse code for common HTTP operations and to structure projects
so developers with knowledge of the framework can more quickly build and
maintain the application.</p>
<h2>Common web framework functionality</h2>
<p>Frameworks provide functionality in their code or through extensions to
perform common operations required to run web applications. These common
operations include:</p>
<ol>
<li>URL routing</li>
<li>HTML, XML, JSON, and other output format templating</li>
<li>Database manipulation</li>
<li>Security against Cross-site request forgery (CSRF) and other attacks</li>
</ol>
<p>Not all web frameworks include code for all of the above
functionality. Frameworks fall somewhere between simply executing a
single use case and attempting to be everything to every developer with
increased complexity. Some frameworks take the "batteries-included" approach
where everything possible comes bundled with the framework while others
have a minimal code library that plays well with extensions.</p>
<p>For example, the Django web application framework includes an
Object-Relational Mapping (ORM) layer that abstracts relational database
read, write, query, and delete operations. However, Django's ORM
cannot work without significant modification on non-relational databases such as
<a href="http://www.mongodb.org/">MongoDB</a>.
Some other web frameworks such as Flask and Pyramid are easier to
use with non-relational databases by incorporating external Python libraries.
There is a spectrum between minimal functionality with easy extensibility and
including everything in the framework with tight integration.</p>
<h2>General web framework resources</h2>
<ul>
<li>
<p>"<a href="http://www.jeffknupp.com/blog/2014/03/03/what-is-a-web-framework/">What is a web framework?</a>"
by <a href="https://twitter.com/jeffknupp">Jeff Knupp</a>
is an in-depth explanation of what web frameworks are and their relation
to web servers.</p>
</li>
<li>
<p>Check out the answer to the
"<a href="http://stackoverflow.com/questions/4507506/what-is-a-web-framework-how-does-it-compare-with-lamp">What is a web framework and how does it compare to LAMP?</a>"
question on Stack Overflow.</p>
</li>
<li>
<p><a href="http://youtu.be/W6KCPXl6Zuc">Frameworks</a> is a really well done short video
that explains how to choose between web frameworks. The author has some
particular opinions about what should be in a framework. For the most part
I agree although I've found sessions and database ORMs to be a helpful
part of a framework when done well.</p>
</li>
<li>
<p><a href="https://www.airpair.com/python/posts/django-flask-pyramid">Django vs Flask vs Pyramid: Choosing a Python Web Framework</a>
contains background information and code comparisons for similar
web applications built in these three big Python frameworks.</p>
</li>
<li>
<p>This <a href="http://www.konstruktor.ee/blog/python-web-framework-roundup/">Python web framework roundup</a>
covers Django, Flask and Bottle as well as several other lesser known Python
frameworks.</p>
</li>
<li>
<p>This fascinating blog post takes a look at the
<a href="http://grokcode.com/864/snakefooding-python-code-for-complexity-visualization/">code complexity of several Python web frameworks</a>
by providing visualizations based on their code bases.</p>
</li>
<li>
<p><a href="http://www.reddit.com/r/webdev/comments/2les4x/what_frameworks_do_you_use_and_why_are_they/">What web frameworks do you use and why are they awesome?</a>
is a language agnostic Reddit discussion on web frameworks. It's interesting
to see what programmers in other languages like and dislike about their
suite of web frameworks compared to the main Python frameworks.</p>
</li>
</ul>
<h2>Web frameworks learning checklist</h2>
<p><i class="fa fa-check-square-o"></i>
Choose a major Python web framework (<a href="/django.html">Django</a> or
<a href="/flask.html">Flask</a> are recommended) and stick with it. When you're just
starting it's best to learn one framework first instead of bouncing around
trying to understand every framework. </p>
<p><i class="fa fa-check-square-o"></i>
Work through a detailed tutorial found within the resources links on the
framework's page.</p>
<p><i class="fa fa-check-square-o"></i>
Study open source examples built with your framework of choice so you can
take parts of those projects and reuse the code in your application.</p>
<p><i class="fa fa-check-square-o"></i>
Build the first simple iteration of your web application then go to
the <a href="/deployment.html">deployment</a> section to make it accessible on the
web.</p>
<h3>Which web framework do you want to learn about?</h3>
<h1>Django</h1>
<p><a href="http://www.djangoproject.com/">Django</a> is a widely used Python web
application framework with a "batteries-included" philosophy. The principle
behind batteries-included is that the common functionality for building
web applications should come with the framework instead of as separate
libraries. </p>
<p><a href="http://www.djangoproject.com/" style="border: none;"><img src="theme/img/django-logo-positive.png" width="100%" alt="Official Django logo. Trademark Django Software Foundation." class="technical-diagram" /></a></p>
<p>For example,
<a href="https://docs.djangoproject.com/en/dev/topics/auth/">authentication</a>,
<a href="https://docs.djangoproject.com/en/dev/topics/http/urls/">URL routing</a>, a
<a href="https://docs.djangoproject.com/en/dev/topics/templates/">templating system</a>,
an <a href="https://docs.djangoproject.com/en/dev/topics/db/">object-relational mapper</a>,
and <a href="https://docs.djangoproject.com/en/dev/topics/migrations/">database schema migrations</a>
(as of version 1.7) are all included with the <a href="https://pypi.python.org/pypi/Django/">Django framework</a>.
Compare that included functionality to the Flask framework which requires a
separate library such as
<a href="https://flask-login.readthedocs.org/en/latest/">Flask-Login</a>
to perform user authentication. </p>
<p>The batteries-included and extensibility philosophies are simply two different
ways to tackle framework building. Neither philosophy is inherently better
than the other.</p>
<h2>Why is Django a good web framework choice?</h2>
<p>The Django project's stability, performance and community have grown
tremendously over the past decade since the framework's creation. Detailed
tutorials and best practices are readily available on the web and in books.
The framework continues to add significant new functionality such as
<a href="https://docs.djangoproject.com/en/dev/topics/migrations/">database migrations</a>
with each release. </p>
<p>I highly recommend the Django framework as a starting place for new Python web
developers because the official documentation and tutorials are some of the
best anywhere in software development. Many cities also have Django-specific
groups such as <a href="http://www.meetup.com/django-district/">Django District</a>,
<a href="http://www.meetup.com/djangoboston/">Django Boston</a> and
<a href="http://www.meetup.com/The-San-Francisco-Django-Meetup-Group/">San Francisco Django</a>
so new developers can get help when they are stuck.</p>
<p>There's some debate on whether
<a href="http://www.jeffknupp.com/blog/2012/12/11/learning-python-via-django-considered-harmful/">learning Python by using Django is a bad idea</a>.
However, that criticism is invalid if you take the time to learn the Python
syntax and language semantics first before diving into web development.</p>
<h2>Django tutorials</h2>
<ul>
<li>
<p><a href="http://www.obeythetestinggoat.com/">Test-Driven Development with Python</a>
focuses on web development using Django and JavaScript. This book uses
the development of a website using the Django web framework as a real
world example of how to perform test-driven development (TDD). There is
also coverage of NoSQL, websockets and asynchronous responses. The book can
be read online for free or purchased in hard copy via O'Reilly.</p>
</li>
<li>
<p><a href="http://www.tangowithdjango.com/book17/">Tango with Django</a> is an extensive
set of free introductions to using the most popular Python web framework.
Several current developers said this book really helped them get over the
initial framework learning curve. It's recently been updated for Django 1.7!</p>
</li>
<li>
<p>The <a href="http://tutorial.djangogirls.org/en/index.html">Django Girls Tutorial</a>
is a great tutorial that doesn't assume any prior knowledge of Python or
Django while helping you build your first web application.</p>
</li>
<li>
<p><a href="http://twoscoopspress.com/products/two-scoops-of-django-1-6">2 Scoops of Django</a>
by Daniel Greenfeld and Audrey Roy is well worth the price of admission if
you're serious about learning how to correctly develop Django websites.</p>
</li>
<li>
<p><a href="http://effectivedjango.com/">Effective Django</a> is another free introduction
to the web framework.</p>
</li>
<li>
<p>The <a href="http://www.reddit.com/r/django">Django subreddit</a> often has links to
the latest resources for learning Django and is also a good spot to ask
questions about it.</p>
</li>
<li>
<p>Lincoln Loop wrote a
<a href="http://lincolnloop.com/django-best-practices/">Django Best Practices guide</a>
for the community.</p>
</li>
<li>
<p>Steve Losh wrote an incredibly detailed <a href="http://stevelosh.com/blog/2011/06/django-advice/">Django Advice guide</a>.</p>
</li>
<li>
<p><a href="http://programming.oreilly.com/2014/04/simplifying-django.html">Lightweight Django</a>
has several nice examples for breaking Django into smaller simplier
components.</p>
</li>
<li>
<p>The <a href="https://github.com/rogueleaderr/definitive_guide_to_django_deployment">Definitive Guide to Django Deployment</a>