Me @Barcamp Saigon July 2013


"The fewer people care about it, the more I feel I'm special"


Barcamp is always crowded of people. The last Barcamp Saigon (2012) is so boring (venue, topics..). But, this year, I gave it a try. I also decided to present about what I'm interested in, and what I'm working on right now, Django. Btw, I've just messed around with Django for 6 months, so do not expect something too advanced, I'm still a learner.



There're not so many people know about Django, but there're still some guys curious about that cool framework, more than i expected.

In this presentation, I just want to introduce people about the Django's architecture, and a practical example of building an Django web app. The main parts of my presentation are:

* Part 1: Introduction to Django:


- It's a web framework written in Python programming language which means you can build great web applications using Python.

- Django is a MVC (Model - View - Controller) core web framework. But, the Django creators and developers interpret that concept as MTV which is stand for Model - Template - View parts of the stack. What is that mean? Why?

+ The model (M) in Django is responsible for defining the database tables, in Python code of-course. An example:


+ In a traditional MVC framework, the view usually decides how the data looks. But, in Django, the view (V) determines which data is presented, not how.



+ The template (T) is the part that decides how your data looks.


+ In Django stack, the Controller is the framework itself  what is called URLConf. URLConf will do the mapping between users's request and the appropriate view:



For more information or deeper understanding of Django MTV architecture, please read the following article: Django and MTV by Jeff Croft


* Part 2: Demo:

- To build a Django application, we will follow some steps:

+ Run the startproject command:

$ djangoadmin.py startproject myproject

+ Inside your new project, run startapp:

$ ./manage.py startapp myapp

+ Modify the settings.py inside myproject/myproject/ (database connection, static directory path, template path...)

+ Define your data in models.py inside myproject/myproject/myapp

+ Write your view in views.py inside myproject/myproject/myapp

+ Design your template

+ Map users requests with your views in urls.py in myproject/myproject/

+ Run your development server by the command:

$ ./manage.py runserver


* Part 3: Something great about Django that I love

- Asynchronous executing tasks with Django-Celery

You can read some of my blog posts about Celery:

http://iambusychangingtheworld.blogspot.com/2013/07/django-celery-display-progress-bar-of.html

http://iambusychangingtheworld.blogspot.com/2013/04/asynchronously-sending-email-using.html







I use slid.es to create the html layout of the slides with reveal.js lib. I then integrated it into an Django app to present at the event. Here It is:






P/S: my presentation in barcampsaigon's website: http://www.barcampsaigon.org/2013/07/django-nguyen-trong-dang-trinh/

Comments