[Django Series] – Django Project Structure

I’m pretty sure that once you understand the mission of every single thing in a Django project, you’ll feel much better to roll up your sleeves and start coding. If you’re still not confident in creating a new Django project, have a look at my previous post at here.

After creating a project, you’ll have a folder structure look like this:

Figure 1. Django Project Structure

Let’s go into details:

  1. The myenv folder is actually your Virtual Environment folder (like I said in the last post, Virtual Environment is actually a folder that holds all the dependencies and packages). It’s quite interesting to examine this, but at a novice level, we’d better not to touch it.
  2. The outer helloWorld folder is just a container for your project. It includes your project control, and apps (we’ll learn more about apps later). You can feel free to rename it to anything you like (well, it’s JUST a container, no one cares how you name it).
  3. The manage.py file is going to help you execute Django commands from within your project. (If you followed my last article, you must have touched this by typing python3 manage.py runserver to run the server for the very first time)
  4. The inner helloWorld folder is your project control, it contains some project-level files that help you configure your project. What are they?
  • __init__.py lets you know and tells Python that this folder is a Python package. (we’ll talk about Package later)
  • settings.py has configuration information for your Django project. You’ll need to register your apps, your templates here. Don’t worry if those words sound unfamiliar to you. They’ll be explained very soon.
  • urls.py at this point only contains a singly URL for the admin. Once we start the project and create some more apps, we’ll definitely extend this.
  • wsgi.py is only used in deployment. So let’s ignore it by now.

That should be enough at the moment. I guess you might have some confusions after reading this, but time and practice will answer all. In the mean time, I’ll explain project and apps (since I have mentioned them several times):

Project: A single project creates a single website. A project contains from one to many apps.

App: Each app features one aspect or one function of the website (for example: handling user authentication, displaying products or handling payments.)

Well, now I should get back to my work. In the next post, I’ll show you how to create the very first simple app.

Happy Coding!



Nigel George 2018, Build Your First Website with Django 2.1, Independent Publishing.


Leave a Reply

Your email address will not be published. Required fields are marked *