Talk Outline ● What is Django and why use Django? ● Django architecture - MVT kind of MVC ● How does Django works? ● Simplified URL routing syntax in Django2 ● Other new features in Django2 ● When should you move your old project to Django2
1. The browser sends request to your web server 2. Your web browser sends request to Web Server Gateway interface(WSGI) or directly serves to a HTML file 3. Unlike a web server , WSGI servers can run Python applications. The request populates a Python Dictionalry called environ , and passes several layers of middlewares, begore reaching your django application. 4. URL conf module which contains the urls.py of your project select a view to handle the request based on the requested URL. The requested view will be turned to HttpRequest, a Python object 5. The selected view typically does one or more of things : a) Talks to a database via models b) Renders HTML or any formatted response using templates c) Raise exception 6. The HttpResponse object gets rendered into string , it leaves django application 7. A beautifully rendered web page is seen
Working Asynchronously ● What if your server ends up waiting for a single request for a long time? ● You are wasting your valuable time ● Working asynchronously by celery, Django channel possible ● Django channels 2 was released using python 3 async and await method