skip to Main Content

I am a beginner 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 doesn’t exist. Please help, thanks.

2

Answers


  1. Chosen as BEST ANSWER

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


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search