Django Creating a Project
Begin a Django Project
Before you can build anything in Django, you need to start a fresh project. This initializes the base structure and essential tools.
Launch Virtual Environment (Optional, But Recommended)
Isolate project libraries using this line:
python -m venv env
Then activate:
Windows:
env\Scripts\activate
macOS/Linux:
source env/bin/activate
Now, you're working inside a clean setup, separate from other Python work.
Install Django
Use Python's package manager:
pip install django
This fetches the framework so you can use its tools and features.
Generate the Project
Use the command below to make a starter project:
django-admin startproject coolsite
This creates a folder called coolsite/ containing starter files.
Now switch into it:
cd coolsite
Test the Setup
Run the development server to make sure everything works:
python manage.py runserver
After that, go to:
http://127.0.0.1:8000/
If the default welcome screen appears, you're ready to build.
What Just Happened?
Let’s review what you've done:
- Initialized an environment (optional but good practice)
- Installed Django libraries
- Created a new web starter folder with key scripts
- Confirmed everything runs fine
What’s Next?
Once your project is set, you can begin adding apps to organize different parts of your site.
Use:
python manage.py startapp shop
This makes a new app called shop inside your project.
Prefer Learning by Watching?
Watch these YouTube tutorials to understand HTML Tutorial visually:
What You'll Learn:
- 📌 How to Create Frist Django Project in Visual Studio Code (2024)
- 📌 Django Beginner | Portfolio Resume Website