DEV Community

Mulky mohammed
Mulky mohammed

Posted on

HOW TO CREATE A SIMPLE DJANGO WITH TWO APPS: BLOG AND STORE

Image descriptionIntroduction
Django is a powerful web framework for building scalable and secure web applications with Python. In this guide, we will walk through how to:

  • Set up a Django project

  • Create two applications (blog and store)

  • Configure and test them in the browser

Requirements

  • Python installed (python-- version)

  • Basic knowledge of terminal commands

  • VS Code or any text editor

  • Git Bash/CMD/Powershell

Step 1: Set Up a Virtual Environment
Open your terminal and run:

Image description
Then activate it:
Image description

Step 2:Install Django

Image description

  • Confirm Django is installed

Image description

Step 3:Create Your Django Project

Image description

This will create the following structure:

Image description

Step 4: Create Two Apps: blog and store

Image description

Step: Register Apps in Settings
Edit mysite/settings.py:

Image description

Step 6:Add views
Blog/views.py

Image description

Store/views.py

Image description

Step 7:Set Up URLs

  • Create blog/urls.py:

Image description

  • Create store/urls.py:

Image description

  • Create store/urls.py:

Image description

Step 8:Run the Development Server

Image description

Now visit your browser

blog, http://127.0.0.1:8000/
Image description

store, http://127.0.0.1:8000/blog/

Image description

Top comments (0)