I am Trying to create my first Django Project on VS Code and I cant figure out how properly install the packages needed

Question:

I am a begginer programmer who was trying to create his first project in VS Code. I installed in the Windows Powershell Django and activated a virtual environment as followed through the following pages:

  1. https://docs.djangoproject.com/en/4.2/howto/windows/

And also tried to install it on VS Code directly following this tutorial on YT:

https://www.youtube.com/watch?v=Wfu5dPbiyKA

however the following problems occur when I check the files in VS Code

wsgi.py:

from django.core.wsgi import get_wsgi_application

This line throws the following warning:

Import "django.core.wsgi" could not be resolved from source

and the same error is thrown in the urls.py file and asgi.py file for the following:

Asgi: from django.core.asgi import get_asgi_application
Urls:

from django.contrib import admin
from django.urls import path

After some research I discovered that either I installed incorrectly Django into my computer or VS Code or either I can install them individually, however neither have worked as when I try to check the status of django it says that the module doesnt exist. Please help, thanks

Asked By: IamJD13

||

Answers:

Sorry, I cannot comment due to low reputation level… So I write it inside this answer…

So following https://docs.djangoproject.com/en/4.2/howto/windows/ you should have python installed, created a virtual environment, entered the environment with ...> project-nameScriptsactivate.bat and then installed django with pip install django.
After this, you should be able to use the django-admin --version command in your terminal.

After this is working, you can start a django project following the official tutorial: https://docs.djangoproject.com/en/4.2/intro/tutorial01/

Create the project with django-admin startproject projectname and start the server with python manage.py runserver.

VS Code should have nothing to do with that. You can also use the terminal inside VS Code to run all the commands, but I would recommand using the original windows terminal for the start – just to be sure its working.

Answered By: Geilmaker

The information from the pinned comment was enough for me to solve my issue.

Answered By: IamJD13