{"id":1647,"date":"2026-09-14T04:00:29","date_gmt":"2026-09-14T04:00:29","guid":{"rendered":"https:\/\/nayananimsara.online\/?p=1647"},"modified":"2026-09-14T04:00:33","modified_gmt":"2026-09-14T04:00:33","slug":"django-project-structure-explained","status":"publish","type":"post","link":"https:\/\/nayananimsara.online\/django-project-structure-explained\/","title":{"rendered":"Django Project Structure Explained: 6 Files Every Beginner Must Know"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Django Project Structure Explained: 6 Files Every Beginner Must Know<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Django Project Structure Explained, The first time I ran <code>django-admin startproject<\/code> and looked inside the folder, I felt a small wave of panic. There were files I&#8217;d never seen before, names like <code>wsgi.py<\/code> and <code>asgi.py<\/code>, and nobody around to tell me what any of it meant. I clicked through everything, understood almost nothing, and just started building anyway.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Looking back, I wish someone had just sat me down and walked through the Django project structure file by file. So that&#8217;s exactly what I&#8217;m doing for you today.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What You See After Creating a Project<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When you run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>django-admin startproject myfirstproject<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Django generates a folder that looks something like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>myfirstproject\/\n    manage.py\n    myfirstproject\/\n        __init__.py\n        settings.py\n        urls.py\n        asgi.py\n        wsgi.py<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, there are two folders with the same name \u2014 that confused me too. The outer one is just the container for your whole project. The inner one is the actual configuration package. Let&#8217;s go through each file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>django-admin startproject myfirstproject .<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"681\" height=\"366\" src=\"https:\/\/nayananimsara.online\/wp-content\/uploads\/2026\/09\/image-9.png\" alt=\"Django Project Structure Explained\" class=\"wp-image-1650\" srcset=\"https:\/\/nayananimsara.online\/wp-content\/uploads\/2026\/09\/image-9.png 681w, https:\/\/nayananimsara.online\/wp-content\/uploads\/2026\/09\/image-9-300x161.png 300w\" sizes=\"(max-width: 681px) 100vw, 681px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">1. manage.py \u2014 Your Command Center<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This is the file you&#8217;ll touch the most. Every time you run a server, create an app, or apply a migration, you&#8217;re running a command through <code>manage.py<\/code>. I think of it as the remote control for the entire project.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python manage.py runserver\npython manage.py startapp blog\npython manage.py migrate<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You never really need to edit this file \u2014 just use it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. settings.py \u2014 The Brain of the Project<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>manage.py<\/code> is the remote, <code>settings.py<\/code> is the brain behind everything. This is where you configure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Installed apps (<code>INSTALLED_APPS<\/code>)<\/li>\n\n\n\n<li>Database connection details<\/li>\n\n\n\n<li>Time zone and language<\/li>\n\n\n\n<li>Static and media file paths<\/li>\n\n\n\n<li>Security settings like <code>SECRET_KEY<\/code> and <code>ALLOWED_HOSTS<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Whenever I add a new app to a project, this is the first file I open, right after <code>startapp<\/code>. Forgetting to register your app here is one of the most common beginner mistakes \u2014 I&#8217;ve done it more times than I&#8217;d like to admit.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. urls.py \u2014 The Traffic Controller<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This file decides what happens when someone visits a URL on your site. By default, it only has one route \u2014 the admin panel:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">python<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>urlpatterns = &#91;\n    path('admin\/', admin.site.urls),\n]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As you build out your project, you&#8217;ll add more paths here, or better yet, connect them to separate <code>urls.py<\/code> files inside each app. That keeps things organized once your project grows past a handful of pages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. wsgi.py \u2014 For Traditional Servers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WSGI stands for Web Server Gateway Interface. Honestly, as a beginner, you don&#8217;t need to touch this file at all. It matters when you&#8217;re deploying your project to a live server that doesn&#8217;t support asynchronous requests \u2014 think traditional hosting setups.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. asgi.py \u2014 For Modern, Async Servers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This one&#8217;s newer, and it exists to support asynchronous features \u2014 things like WebSockets or real-time chat apps. Again, you won&#8217;t need to edit this early on, but it&#8217;s good to know it&#8217;s there for when your projects get more advanced.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. <strong>init<\/strong>.py \u2014 The Quiet One<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This file is usually empty. Its only job is to tell Python that the folder it&#8217;s sitting in should be treated as a package. You&#8217;ll probably never open it, but don&#8217;t delete it either.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Happens When You Create an App<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you run <code>python manage.py startapp blog<\/code>, Django adds a new folder with its own set of files:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>models.py<\/code> \u2014 where you define your database tables<\/li>\n\n\n\n<li><code>views.py<\/code> \u2014 where you write the logic for what shows up on a page<\/li>\n\n\n\n<li><code>admin.py<\/code> \u2014 where you register models to appear in the admin panel<\/li>\n\n\n\n<li><code>apps.py<\/code> \u2014 configuration for the app itself<\/li>\n\n\n\n<li><code>migrations\/<\/code> \u2014 a folder that tracks database changes over time<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This app-based structure is one of the things I genuinely appreciate about Django. Each app is meant to handle one specific feature, so your project doesn&#8217;t turn into one giant tangled file as it grows.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why This Structure Actually Matters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When I started out, I treated all this as boilerplate I could ignore. But once I began building bigger projects, understanding where each piece lived saved me so much debugging time. If something breaks with URLs, I know to check <code>urls.py<\/code>. If a new app isn&#8217;t showing up, I know <code>settings.py<\/code> is the first place to look.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That kind of muscle memory only comes from actually knowing what each file does, not just copying commands from a tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Quick Tip From Experience<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t try to memorize every file&#8217;s purpose in one sitting. I didn&#8217;t. I learned this structure slowly, by breaking things and figuring out which file controlled what. If you want a refresher on the actual commands used to generate this structure, check out my earlier post on how to create your first Django project \u2014 it walks through the exact steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For deeper technical details on any of these files, the <a href=\"https:\/\/docs.djangoproject.com\/\" target=\"_blank\" rel=\"noopener\">official Django documentation<\/a> is genuinely one of the better-written framework docs I&#8217;ve come across.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Thoughts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Django project structure looks intimidating for about a week, and then it just becomes familiar. Once you understand what <code>settings.py<\/code>, <code>urls.py<\/code>, and the app folders actually do, the rest of Django starts making a lot more sense too.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open up your own project folder right now and match each file to what you just read. That&#8217;s the fastest way to make this stick.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If anything&#8217;s still unclear, drop a comment \u2014 I&#8217;ll help you work through it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/nayananimsara.online\/course\/django-for-beginners-learn-python-web-development-from-scratch\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/nayananimsara.online\/course\/django-for-beginners-learn-python-web-development-from-scratch\/\" rel=\"noreferrer noopener\">Full Course<\/a><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"tg-oembed-container\"><iframe title=\"WebHD 720p 4\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/Ivtqm-2JBrg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Django Project Structure Explained: 6 Files Every Beginner Must Know Django Project Structure Explained, The first time I ran django-admin startproject and looked inside the folder, I felt a small wave of panic. There were files I&#8217;d never seen before, names like wsgi.py and asgi.py, and nobody around to tell me what any of it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1650,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"elearning_container_layout":"tg-site-layout--default","elearning_sidebar_layout":"tg-site-layout--default","elearning_remove_content_margin":false,"elearning_sidebar":"default","elearning_transparent_header":"customizer","elearning_logo":0,"elearning_header_style":"default","elearning_menu_item_color":"","elearning_menu_item_hover_color":"","elearning_menu_item_active_color":"","elearning_menu_item_active_style":"","elearning_page_header":true,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/posts\/1647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/comments?post=1647"}],"version-history":[{"count":3,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/posts\/1647\/revisions"}],"predecessor-version":[{"id":1654,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/posts\/1647\/revisions\/1654"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/media\/1650"}],"wp:attachment":[{"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/media?parent=1647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/categories?post=1647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayananimsara.online\/wp-json\/wp\/v2\/tags?post=1647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}