Confusion Installing Django

I am brand new to Django and I’m trying to follow an on-line tutorial. I’m working on Windows 10 and installed everything that I was asked to - I think, but I don’t see Django modules when creating code in Visual Studio. There are not a whole lot of modules listed. I found one, django-urls that I installed, but that’s about it. Do I have to install each django module by hand?

This is my environment:
Windows 10
Python 3.8.6
pip 20.2.1
virtualenvwrapper-win 1.2.6
virtualenv 20.0.32
(In Virtual Environment) Django 3.1.2
Visual Studio 16.7.5

Just about everything is missing:
unresolved import ‘django.shortcuts’
unresolved import ‘django.http’
unresolved import ‘django.contrib’
etc.

Results from a “pip freeze” command in the virtual environment:
asgiref==3.2.10
Django==3.1.2
django-urls==1.1.3
pytz==2020.1
sqlparse==0.3.1

Hi!

It would be helpful if you provide the link to the tutorial you’re making, or the detailed steps you followed.

You don’t need to install each django module, they come “inside” Django itself.


unresolved import ‘django.shortcuts’
unresolved import ‘django.http’
unresolved import ‘django.contrib’

This error messages are from VSCode. I think it’s not recognizing your python virtualenv, which is where you installed Django. You must select the Python interpreter.

I recommend you to make the Django tutorial from VSCode, as it shows interesting features to work with Django projects.

My bad. The tutorial is here:

I am not making a tutorial, I’m trying to follow one.

Sorry, I meant following when I said making.

  • Could you select the python interpreter?
  • Did you activate your virtualenv? (Minute 22)
  • Until what part of the video did you get?
  • Yes, I can select the Python environment - I think. On the top right of VS.

  • Yes, I did activate virtualenvironment.

  • I noticed the problem about minute 26 in the video.

It might be an issue with configuring VisualStudio. When I go directly to my virtual environment and run Python, the interpreter seems to find everything. Unfortunately I am a newbee with VS also and I’m not sure how to set that up.

From stand alone Windows Command Prompt:
Q:>lsvirtualenv

dir /b /ad “C:\Users\em817m\Envs”

frontdoortest

Q:>workon frontdoortest
(frontdoortest) Q:>python
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

from django.shortcuts import render
from django.http import HttpResponse
from django.urls import path, include

At minute 19 the instructor says you have to download Visual Studio Community, but then he opens Visual Studio Code, which is a different program.

I don’t mean you can’t code in Visual Studio but the tutorial is being taught with VS Code. I don’t understand why nobody told him in the comments.

Can you suggest a good install & tutorial on Django, virtualenvwrapper-win, Python, and Visual Studio?

That’s Visual Studio Community.

The Django How-To guide should help get you started on the Python / Django side.

The Microsoft Visual Studio site has tons of resources - see their Getting Started with Django page.

You can visit geeksforgeeks website for installing Django.
For video demonstration you visit codewithharry Youtube channel. It is pretty good. I personally follow this channel for learning Django.

All, thanks for all the suggestions. After watching many Visual Studio, Django and Virtual Environment videos I finally got things to work. I was able to create the django “Hello World” web page and display it, (the first app example in the “django For Beginners” video). The major change I implemented was using the python “venv” process to create my virtual environment and not the virtualenvwrapper-win that was suggested in the video. I’m not sure if that was the cause of my problems or not. All I know is that it worked.

Anyway, thanks for the suggestions.