{"id":120189,"date":"2024-12-17T03:36:35","date_gmt":"2024-12-17T03:36:35","guid":{"rendered":"\/tutorials\/?p=120189"},"modified":"2026-03-10T09:01:43","modified_gmt":"2026-03-10T09:01:43","slug":"how-to-create-a-django-project","status":"publish","type":"post","link":"\/au\/tutorials\/how-to-create-a-django-project","title":{"rendered":"How to create a Django project"},"content":{"rendered":"<p>Creating a Django project is the first step in harnessing the power of this popular web framework. Known for its &ldquo;batteries-included&rdquo; philosophy, Django provides developers with a comprehensive set of tools for tasks like user authentication, content administration, and database management.<\/p><p>This combination of features makes Django a favorite for building dynamic, data-driven websites and applications. <\/p><p>In this tutorial, we&rsquo;ll guide you through the process of setting up and creating your first Django project. Let&rsquo;s get started!<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2><p>Before you start creating your Django project, you&rsquo;ll need a VPS for your projects. Hostinger&rsquo;s <a href=\"\/au\/vps\/django-hosting\">Django VPS hosting<\/a> provides an environment specifically tailored to getting your Django projects up and running quickly.<\/p><p>The most popular plan comes with <strong>2 vCPU<\/strong> cores, <strong>8 GB<\/strong> RAM, and <strong>100 GB <\/strong>of NVMe SSD storage, which is suitable for up to a medium-scale Django project.<\/p><p>After purchasing a server to host your project, <a href=\"\/au\/tutorials\/how-to-install-django\">install Django<\/a> since we will use its command to set up the project directory. If you use Hostinger&rsquo;s VPS, you can easily set up the framework by choosing the Django template during the onboarding process.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/au\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Also set up a <a href=\"\/au\/tutorials\/how-to-create-a-python-virtual-environment\">Python virtual environment<\/a> to isolate your application data from other projects and services in your system.<\/p><p>Connect to your server via <a href=\"\/au\/tutorials\/how-to-use-putty-ssh\">SSH using PuTTY<\/a> or Terminal. For Hostinger users, you can access your VPS in one click using <strong>Browser terminal<\/strong> by simply clicking the button on your VPS management page.<\/p><p>Once connected, let&rsquo;s create a new Django project.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-create-a-new-django-project\">How to create a new Django project?<\/h2><p>It&rsquo;s time to create your first Django app. In this section, you will establish the codebase foundation needed to begin developing your project.<\/p><ol class=\"wp-block-list\">\n<li>Go to your project directory. If you&rsquo;re not already in the directory where you want to create the project, use the <strong>cd <\/strong>command to navigate there.<\/li>\n\n\n\n<li>Use Django&rsquo;s <strong>startproject <\/strong>command to create a new project. Replace <strong>myproject<\/strong> with the name of your project:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">django-admin startproject myproject<\/pre><p>The above command would create a new directory named <strong>myproject <\/strong>containing the default project structure.<\/p><ol start=\"3\" class=\"wp-block-list\">\n<li>Then, navigate to your project&rsquo;s inner folder:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd myproject\/myproject<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Open <strong>settings.py<\/strong> using one of the default Ubuntu text editors (<strong>nano<\/strong> or <strong>vim<\/strong>):<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vim settings.py<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Locate the <strong>ALLOWED_HOSTS<\/strong> setting and add your VPS IP as follows. This configuration ensures your server can access and serve the Django project:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ALLOWED_HOSTS = ['your_vps_ip']<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Save the changes and quit vim by entering <strong>:wq<\/strong>.<\/li>\n\n\n\n<li>To verify that everything is set up correctly, you can start the Django development server. Return to the parent project category and enter <strong>runserver<\/strong>:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd ..<\/pre><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python manage.py runserver 0.0.0.0:8000<\/pre><p>Now, open your browser and go to <strong>http:\/\/your_vps_ip:8000\/ <\/strong>with <strong>your_vps_ip<\/strong> being your actual VPS IP. If the setting was correct, you should see the Django welcome page:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c85911f3f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"521\" height=\"355\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/install_django_2.png\" alt='Screenshot displaying default Django web page, containing text \"The install worked successfully! Congratulations!\" as well as a rocket launching above the text and version information below.' class=\"wp-image-116657\"  sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>If you followed through with these steps, you successfully built and executed a default Django project on your VPS.<\/p><h3 class=\"wp-block-heading\" id=\"h-understanding-the-django-project-structure\">Understanding the Django project structure<\/h3><p>Running the <strong>startproject <\/strong>command creates a basic Django project structure that includes several key files and directories. Each of them plays a specific role in your Django project. Here&rsquo;s a breakdown of the structure and the purpose of each component:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c85914b5f\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"257\" height=\"219\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_1.png\" alt=\"Screenshot displaying default Django project structure: db.sqlite3 and manage.py files in the main myproject directory and init.py, asgi.py, settings.py, urls.py, wsgi.py files and pycache category inside the inner myproject directory\" class=\"wp-image-116659\"  sizes=\"auto, (max-width: 257px) 100vw, 257px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><strong>myproject\/<\/strong><\/p><p>The inner project directory containing the core settings, configurations, and other default files for your Django project.<\/p><p><strong>manage.py<\/strong><\/p><p>This command-line utility lets you interact with your Django project. You use it for tasks such as running the development server, migrating databases, and managing your application.<\/p><p>Here&rsquo;s what it looks like:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c85917594\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"678\" height=\"442\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_2.png\" alt=\"Screenshot of the default manage.py file opened in VS code editor\" class=\"wp-image-116662\"  sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>These are its key functions:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c8591a665\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"22\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_3.png\" alt=\"Screenshot of text &quot;os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')\" class=\"wp-image-116665\"  sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Sets the environment variable to tell Django which settings file to use.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c8591dda2\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"301\" height=\"18\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_4.png\" alt='Screenshot of text \"execute_from_command_line(sys.argv)\"' class=\"wp-image-116666\"  sizes=\"auto, (max-width: 301px) 100vw, 301px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Runs various Django commands such as <strong>runserver<\/strong>, <strong>migrate<\/strong>, and others.<\/p><p><strong>__init__.py<\/strong><\/p><p>This file converts your project directory as a Python package, allowing Python to import your project code as a module. It&rsquo;s empty by default.<\/p><p><strong>settings.py<\/strong><\/p><p>This is one of the most crucial files in Django. It contains all the settings for your project, including database configurations, installed apps, middleware, and static file settings.<\/p><p><strong>urls.py<\/strong><\/p><p>This file defines the URL routes for your application. It maps URLs to <a href=\"\/au\/tutorials\/building-django-views\">views<\/a> that process requests and return responses.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c85921984\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"365\" height=\"135\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_5.png\" alt=\"Screenshot of a default url.py file structure\" class=\"wp-image-116667\"  sizes=\"auto, (max-width: 365px) 100vw, 365px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>As you add more functionality to your application, you&rsquo;ll extend <strong>urlpatterns<\/strong> to include routes for your own views.<\/p><p><strong>asgi.py<\/strong><\/p><p>This file provides an entry point for ASGI-compatible web servers to serve your project. ASGI (Asynchronous Server Gateway Interface) is the standard for asynchronous Django applications.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c8592473d\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"154\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_6.png\" alt=\"Screenshot of a default asgi.py file structure\" class=\"wp-image-116669\"  sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><strong>wsgi.py<\/strong><\/p><p>This file is the entry point for WSGI-compatible web servers such as Gunicorn or uWSGI to serve your project in a production environment.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69f8c859280aa\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"152\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/09\/understanding_the_project_structure_7.png\" alt=\"Screenshot of a default wsgi.py file structure\" class=\"wp-image-116670\"  sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Understanding the role of each file and directory will equip you to modify settings, add URLs, and manage your project&rsquo;s structure.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>To begin working with Django you&rsquo;ll first need to learn how to create a project. The process is really not that complicated and can be done in a few steps.<\/p><p>Before doing so, however, make sure you have a server with sufficient hardware according to your project&rsquo;s need. Also, your system should have Django installed and environment variable set.<\/p><p>To summarize, go to your projects directory and use the <strong>startproject <\/strong>command to create a new project. Navigate to your project&rsquo;s inner folder and add your server&rsquo;s IP to <strong>ALLOWED_HOSTS<\/strong>. If all is done correctly, your new blank project should be up and running.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-create-django-project-faq\">How to create Django project FAQ<\/h2><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-694a83d6e5f4c\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How do I configure settings in a Django project?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>To configure your Django project settings, open the u003cstrongu003esettings.pyu003c\/strongu003e file inside your project directory. Here, you can change various configurations by adjusting the value of each parameter. For example, you can toggle the debug mode or list known hosts.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-694a83d6e5f50\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How do I run the Django development server?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>To run the Django development server, open your systemu0026rsquo;s terminal and navigate to your project folder, which contains theu003cstrongu003e manage.pyu003c\/strongu003e file. Activate your virtual environment if you use one. Then, enter u003cstrongu003epython manage.py runserveru003c\/strongu003e to start the development server usingu003cstrongu003e u003c\/strongu003evia port u003cstrongu003e8000u003c\/strongu003e.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Creating a Django project is the first step in harnessing the power of this popular web framework. Known for its &ldquo;batteries-included&rdquo; philosophy, Django provides developers with a comprehensive set of tools for tasks like user authentication, content administration, and database management. This combination of features makes Django a favorite for building dynamic, data-driven websites and [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/au\/tutorials\/how-to-create-a-django-project\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":185,"featured_media":138148,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to create a Django project in Python","rank_math_description":"Check this article to learn how to create a Django project: go to the project directory, run the command startproject, and add your server's IP.","rank_math_focus_keyword":"how to create a django project","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-120189","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-create-a-django-project","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-create-a-django-project","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts\/120189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/users\/185"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/comments?post=120189"}],"version-history":[{"count":11,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts\/120189\/revisions"}],"predecessor-version":[{"id":141070,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/posts\/120189\/revisions\/141070"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/media\/138148"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/media?parent=120189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/categories?post=120189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/au\/tutorials\/wp-json\/wp\/v2\/tags?post=120189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}