Code Monkey home page Code Monkey logo

django-tweet-cs's Introduction

Django-Tweet-CS

  • Each project can have multiple apps (applications) which are separate from each other. These apps are reusable (they can be added to other projects instead of re-creating them)

  • When we provide a route in the browser URL, Django checks in the Project's urls.py file for the presence of that route in the urlpatterns list. If it finds it, then it takes the corresponding action as mentioned by the second parameter. Since we have include("blog.urls") as the second argument, Django navigates the the Blog app's urls.py file and checks for the presence of the remainder of the route in the urlpatterns list (blog/ will already match the route present in Project's urls.py file, so that part will get eliminated, and only the rest of the route will be passed on to the app's urls.py file). If a route is found, then the corresponding view (passed in as the second argument in the url mapping) will be executed

  • Steps involved in creating routes:

  • Create the logic in the views.py file (this is called a view and hence the filename is views)
  • Create a mapping for this view (in the app's views.py file) to a path (in the app's urls.py file) so as to access this view from that particular path
  • Add a final mapping to route the user from a particular path to a particular app (in the project's urls.py file). The app's urls.py file will handle the mapping for this particular app
  • Always leave the trailing forward slash in any route as Django simply ignores the forward slash regardless of its presence. So it is better for the user as they can provide a forward slash or not, and still get the same result

django-tweet-cs's People

Contributors

rahuls-gith avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.