Slug Based Routing In Django

Slug Based Routing In Django

Our Post model has a slug field that we had set up earlier. Now we want to configure slug based routing in Django. To design URLs for an app, we learned how to use the Python module URLconf or URL configuration. The URLconfg uses Python code to map between URL path expressions and Python functions that are defined in views. Some routing paths are static, and some are dynamic.…

Django Static Files And Images

Django Static Files And Images

Now we are going to add some style to our posts application that we have been building. Django follows conventions for locating static files and images, just like it has conventions for most things. In Django, you can have static files shared across an entire project or on a per-application basis. In this tutorial, we will be setting up a static directory inside of our given application.…

Models In Django

Models In Django

Now that we know about routing in Django and how URLs map to views and view functions that send back Html templates to the user, we can now learn about Models in Django. Models introduce the concept of using dynamic data from a database to power the front end of the website that the user sees and interacts with. For example in our small blog application, we want to store a collection of posts in the database.…

Django App vs Project

Django App vs Project

Everything in Django is centered around the idea of apps. Apps in Django are the self-contained directories that hold files that all work together to provide specific functionality for your Project. A Django project may consist of a single app, or many apps to provide its service. In fact, there is a site dedicated to providing developers all kinds of reusable apps, tools, and more for your Django projects.…

Django HTML Pages

Django HTML Pages

In this tutorial, we are going to explore how to render HTML with Django using Templates. Django is written in Python and is different than how things work in say PHP for example. In PHP we can mix PHP with HTML to output web pages. Django and Python work a little differently. In Django, we use the Django Template Language or DTL templates to output dynamic data generated by Python and Django into HTML pages.…

Django URLs and Views

Django URLs and Views

In this tutorial, we will be looking a little more closely at how Routing works in Django. Any web application needs to look at incoming Http requests and decide what to do with that request. Most times, the application will gather some relevant data, package it up in an Http response, and send it back to the browser. In Django, this process is handled by two files.…

Django Debug Toolbar

Django Debug Toolbar

There are a lot of moving parts underneath the hood of a Django web application. Much of it is very transparent to the user of the site, but it is important for the web developer to know how things are working in order to understand how to debug problems. Django has a Debug Toolbar you can install to allow full inspection of the Django environment during development.…

Django Admin Setup

Django Admin Setup

We’ve made a lot of progress getting started with Django building our small Dog website. We’ve learned about getting Django setup, and creating some basic web pages that display information about Dogs in our system. Currently, the only way to interact with the data for our website is via a web browser on the front end of the site. Django has an administrative backend that is pre-built for you.…