Web Development in Django

8,457 views

Published on

Introduction to Web development in django framework

Published in: Technology
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
8,457
On SlideShare
0
From Embeds
0
Number of Embeds
1,666
Actions
Shares
0
Downloads
176
Comments
0
Likes
11
Embeds 0
No embeds

No notes for slide

Web Development in Django

  1. 1. Web Development, The Django Way! - An Introduction Presented at Barcamp Bangalore 8 Lakshman Prasad Usware Technologies Pvt Ltd
  2. 2. Building a Django web app. <ul><li>What is Django. </li></ul><ul><li>Why Django? </li></ul><ul><li>Who uses Django </li></ul><ul><li>Tutorial. Go, Hack! </li></ul><ul><li>About Usware </li></ul>
  3. 3. What is Django <ul><li>Python web framework </li></ul><ul><li>Enables Agile Web Development </li></ul><ul><li>Focus on programmer productivity </li></ul><ul><li>Recently hit 1.0 </li></ul><ul><li>Influenced Google's App Engine Framework </li></ul><ul><li>For perfectionists with deadlines </li></ul>
  4. 4. Why Django <ul><li>1995 – Static web pages - Html </li></ul><ul><li>2000 – Some Dynamic components – SSI </li></ul><ul><li>2005 – Dynamic database driven web PAGES – PHP -- C#, J2EE in enterprise </li></ul><ul><li>2009 – Dynamic Web apps, agility, time to market = ??? </li></ul>
  5. 5. Why Django <ul><li>The web is evolving </li></ul><ul><li>Web apps are getting complex </li></ul><ul><li>Ad-hoc solutions like PHP wont do </li></ul><ul><li>Java, .net are time consuming, 'entrprisy'. </li></ul><ul><li>New ways evolve </li></ul><ul><li>'Python makes Programmers HAPPY' :) </li></ul><ul><li>http://www.paulgraham.com/gh.html </li></ul><ul><li>Your best bet is Django. (Or Rails) </li></ul>
  6. 6. Who uses Django <ul><li>Google </li></ul><ul><li>WashingtonPost </li></ul><ul><li>WashingtonTimes </li></ul><ul><li>lawrence.com </li></ul><ul><li>Mahalo Answers </li></ul><ul><li>uswaretech.com :) </li></ul><ul><li>... </li></ul><ul><li>Full List: http://www.djangosites.org/ </li></ul>
  7. 7. Tutorial <ul><li>How Django processes urls </li></ul><ul><li>You request – yoursite.com/page/ </li></ul><ul><li>urls.py decides which view function to call </li></ul><ul><li>views.py decides which models to acess and manipulate. It renders the template. </li></ul><ul><li>What you need to write – urls.py, views.py, models.py, template.html </li></ul>
  8. 8. Awesome features of Django <ul><li>Automatic admin interface – Full crud operations – Its not scaffolding, its the whole house </li></ul><ul><li>Convention over configuration is achieved by inferring, not auto generating </li></ul><ul><li>Plays well with other components </li></ul><ul><li>Can be deployed on a JVM </li></ul>
  9. 9. Tutorial - models.py <ul><li>Defines your datamodel </li></ul><ul><li>Do not need to write all functions – Django infers them, Declarative programming </li></ul><ul><li>Sample code: </li></ul>
  10. 10. Tutorial - urls.py <ul><li>Built with regularexpressions </li></ul><ul><li>Maps url patterns to functions </li></ul><ul><li>Sample code: </li></ul>
  11. 11. Tutorial - views.py <ul><li>Handles requests </li></ul><ul><li>Normal function – Takes a request input, returns RESPONSE object output. </li></ul><ul><li>Sample code: </li></ul>
  12. 12. template.html <ul><li>For each different type of page one template </li></ul><ul><li>Just html, with a little markup for dynamic content </li></ul><ul><li>Built for designers – seperation of concerns </li></ul><ul><li>Sample code </li></ul>
  13. 13. Tools – xkcd.com/378
  14. 14. Tools <ul><li>Ipython console </li></ul><ul><li>easy_install </li></ul><ul><li>Wing IDE , Komodo IDE, PyDev, 20 more.. </li></ul><ul><li>http://stackoverflow.com/questions/81584/what-ide-to-use-for-python/495355 </li></ul>
  15. 15. Reusable Development <ul><li>http://uswaretech.com/blog/2008/11/building-reusable-django-apps/ </li></ul><ul><li>Import from the app level, not project level </li></ul><ul><li>Use named url patterns in urls.py </li></ul><ul><li>Dont Hardcode urls, in views – Ever. </li></ul><ul><li>Use reverse() function to get url patterns </li></ul><ul><li>Use {{ url }} tags in templates for <a href='' ''> </li></ul><ul><li>Templates and statics from 'appname'/ folder </li></ul>
  16. 16. Resources <ul><li>Python: Stephen Holden: Learn python in 3 hours. Dive into Python http://diveintopython.org </li></ul><ul><li>Django: http://docs.django.com/ http://djangobook.com/ </li></ul><ul><li>IRC: #Django #Python on freenode </li></ul><ul><li>StackOverflow: http://stackoverflow.com/questions/tagged/python </li></ul><ul><li>Django vs ROR http://news.ycombinator.com/item?id=195423 </li></ul><ul><li>Mailing List: [email_address] </li></ul>
  17. 17. More Resources <ul><li>http://42topics.com/blog/category/django/ </li></ul><ul><li>Interviews of django creators, President, release manager, and of people moved from .net, ROR </li></ul><ul><li>http://uswaretech.com/blog </li></ul><ul><li>Using django with twitter, facebook, paypal, amazon s3, ... </li></ul><ul><li>http://svn.uswaretech.com/ </li></ul><ul><li>Open Source django apps: A wiki, A blog, A todo list, Jobs, Time tracker, ... </li></ul><ul><li>http://uswaretech.com/blog/2008/11/building-reusable-django-apps/ </li></ul>
  18. 18. About Usware <ul><li>Build web applications with Django (& Jquery) </li></ul><ul><li>Small team of Hackers, Experts in django </li></ul><ul><li>Clients include django development agencies in US, Australia, Europe. http://uswaretech.com/projects/ </li></ul><ul><li>'Building amazing web apps' </li></ul><ul><li>Based in Hyderabad, India </li></ul><ul><li>Say me a 'Hi', anytime: [email_address] </li></ul><ul><li>Go, HACK! </li></ul>

×