How things work - 30 days of Django

How things work - 30 days of Django

/ #Django


Let's go through the different files in toodoo and find out what they do and how they're connected.

Here is the list of files in our project:

  • toodoo->manage.py
  • toodoo->toodoo->__init__.py
  • toodoo->toodoo->asgi.py
  • toodoo->toodoo->settings.py
  • toodoo->toodoo->urls.py
  • toodoo->toodoo->wsgi.py

manage.py
This file is a script for doing administrative tasks. It will be used many times during this series, and we will use it to create super users, create Django apps, interact with the database and similar. Right now, you don't have to think to much about it.

toodoo
Inside the project root folder, we get another folder named "toodoo". This is where all the configuration for the project will be placed. So it's kind of the center of the whole Django project.

toodoo->__init__.py
This file is empty, but it still has a function. It makes Python treat this folder as a module, so it's easy to reference the files inside it and similar.

toodoo->asgi.py
This file is a file the web server will be using (later). Asynchronous Server Gateway Interface. It's entry points for the webserver, and will only be used if the project supports asynchronous views (which we will not cover in this series).

toodoo->settings.py
This is where all the settings will be placed. This is where we define the database connection, where templates are located, security settings, how dates are formatted and similar.

toodoo->urls.py
This file is sort of like a table of contents. The webserver uses this file to find out what to show you when you visit a url.

toodoo->wsgi.py
This file is a file the web server will be using (later). We're not going to do anything with it, but we will use it later when we deploy the project to a live server.

Summary

This might be a little bit information overload, but I promise that everything will start making more sense when we start using the files.

Table of contents

Comments

No comments yet...

Add comment

Info

Please log in to comment!

Newsletter

Subscribe to my weekly newsletter. One time per week I will send you a short summary of the tutorials I have posted in the past week.