Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Django
#1
Hello all.
I am using Visual Studio Code 3.11.8 for python coding practice. Whenever I am trying to import module in python , I am getting Import could not be resolved from source. Can you please help me as soon as possible.
Thanks in advance for your support!

Attached Files

Thumbnail(s)
   
Reply
#2
(Mar-14-2024, 12:26 PM)Sowmya Wrote: I am using Visual Studio Code 3.11.8 for python coding practice
Look down in right corner now you use 3.11.5('demo':venv),so is not using your Python 3.11.8 version.
This mean that most have done pip install django in this virtual environment.
Unsure just make new environment and use that.
# Make 
G:\all_flask\django_stuff
λ python -m venv demo_env

# Cd in
G:\all_flask\django_stuff
λ cd demo_env\

# Activate
G:\all_flask\django_stuff\demo_env
λ G:\all_flask\django_stuff\demo_env\Scripts\activate

# Install
G:\all_flask\django_stuff\demo_env
(demo_env) λ pip install django
Collecting django
.....  
Successfully installed asgiref-3.7.2 django-5.0.3 sqlparse-0.4.4 tzdata-2024.1

# Start
G:\all_flask\django_stuff\demo_env
(demo_env) λ django-admin startproject django_project .

# Make the app that gone use
G:\all_flask\django_stuff\demo_env
(demo_env) λ python manage.py startapp demo_app

# Start VS code 
G:\all_flask\django_stuff\demo_env
(demo_env) λ code .
So now down in right corner i have 3.12.0('demo_env':venv).
Reply
#3
Thanks for your response.
Unfortunatetly, I used this process, but still My problem is not solved. Can you please give me another solution for my problem.
Once again thank you!
Reply
#4
(Mar-14-2024, 01:49 PM)Sowmya Wrote: Unfortunatetly, I used this process, but still My problem is not solved. Can you please give me another solution for my problem.
You most explain what your doing and what's the problem is.
What show is correct,if want an ok link Django for Beginners
As you see is a similar way first make the virtual environment the install an setup stuff.

As you use VS Code must make sure to same environment down in right corner.
In VS Code i have no imports error,and all i have done is in first post.
[Image: bfRq9k.png]
Reply
#5
Thank you for your response.
The image you uploaded in line 12 "from django.core.asgi import get_asgi_application" , I got "Import could not be resolved from source" error.
I don't want to get that error warning . What should I do?
Thanks for your support!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020