How to Install & Run Django in Visual Studio Code | Setup Django in VSCode

Publicado el: 04 marzo 2025
en el canal de: ProgrammingKnowledge
67,521
589

🔥 *Want to set up Django in VS Code? Here's a complete step-by-step guide!*

In this tutorial, I'll show you **how to install and run Django in Visual Studio Code (VS Code)**. Whether you're a beginner or an experienced developer, this guide will help you get started with Django development smoothly.

---

*🔹 What You’ll Learn:*
✅ How to *install Python and Django*
✅ How to *set up a Django project in VS Code*
✅ How to *run the Django development server*
✅ How to *use the VS Code terminal for Django commands*
✅ How to *fix common setup issues*

---

*🔹 Prerequisites:*
✔️ *Python Installed* ([Download here](https://www.python.org/))
✔️ *Visual Studio Code Installed* ([Download here](https://code.visualstudio.com/))
✔️ *Basic Knowledge of Python (Optional)*

---

*Step 1: Install Python and VS Code*

1️⃣ Download and install *Python* from [python.org](https://www.python.org/downloads/)
2️⃣ Install *VS Code* from [code.visualstudio.com](https://code.visualstudio.com/)
3️⃣ Open VS Code and install the *Python extension* from the Extensions Marketplace

---

*Step 2: Install Django in VS Code*

1️⃣ Open *VS Code* and launch the terminal (**Ctrl + `**)
2️⃣ Create a virtual environment (Recommended)

```bash
python -m venv venv
```
3️⃣ Activate the virtual environment:

*Windows:*
```bash
venv\Scripts\activate
```
*Mac/Linux:*
```bash
source venv/bin/activate
```

4️⃣ Install Django:

```bash
pip install django
```

5️⃣ Verify Django installation:

```bash
django-admin --version
```

---

*Step 3: Create a New Django Project*

Run the following command to create a Django project:

```bash
django-admin startproject myproject
```

Navigate into the project folder:

```bash
cd myproject
```

Run the Django development server:

```bash
python manage.py runserver
```

---

*Step 4: Open Django Project in VS Code*

1️⃣ Open the *myproject* folder in VS Code
2️⃣ Install the following VS Code extensions (recommended):
*Python*
*Django*
*Pylance*
3️⃣ Use the integrated terminal to run Django commands

---

*Step 5: Create a Django App*

Inside your Django project folder, create a new app:

```bash
python manage.py startapp myapp
```

Register the app in `settings.py` under `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
...
'myapp',
]
```

---

*Step 6: Run the Django Server & Open in Browser*

1️⃣ Start the Django server:

```bash
python manage.py runserver
```

2️⃣ Open your browser and go to:
👉 *http://127.0.0.1:8000/*

You should see the default Django welcome page! 🎉

---

*Next Steps:*
📌 *How to Create a Django App and Models* → [Watch Now]
📌 *How to Use Django with MySQL* → [Watch Now]
📌 *Deploy Django App on AWS EC2* → [Watch Now]

---

*👍 Like, Share & Subscribe!*
If this tutorial helped you, *LIKE**, **SHARE**, and **SUBSCRIBE* for more Django & VS Code tutorials!

💬 Have questions? Drop them in the *comments* below!

---

*🔹 Hashtags:*
#Django #Python #VisualStudioCode #VSCode #DjangoSetup #DjangoTutorial #WebDevelopment #PythonDevelopment #LearnDjango #Coding


En esta página del sitio puede ver el video en línea How to Install & Run Django in Visual Studio Code | Setup Django in VSCode de Duración online en buena calidad , que subió el usuario ProgrammingKnowledge 04 marzo 2025, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 67,521 veces y le gustó 589 a los espectadores. Disfruta viendo!