Im totaly green in python dev and i stuck on the beginning on tutorial.
I bought course to quickly learn how to make REST API in Python with Django and DjangoRestFramework.
At first attempt i stuck at the moment, where i creating first model because of error:
Import "django.db" could not be resolved from
sourcePylancereportMissingModuleSource
I have a lot of issues with PyCharm with Anaconda on my M1 MacOs, so i moved on to Visual Studio Code with extenstions to create a new project, but im currently stuck on this command:
python3 manage.py startapp sue_api
It causes a error:
ImportError: Couldn’t import Django. Are you sure it’s installed and
available on your PYTHONPATH environment variable? Did you forget to
activate a virtual environment?
I’ve installed Django and DjangoRestFramework using requirements.txt and command:
pip3 install -r requirements.txt
And all requirements are satisfied. So whats wrong there? Im in my created enviroment and have no idea what to do.
>Solution :
There error that you are getting indicates that Django is not installed yet. so first of all try django-admin command and see if the package is installed correctly.
if not then you have to install the package with pip or any package manager like poetry or pipenv or even install it directly from github page:
pip install Django
so check your requirements.txt and make sure django is there.
and also make sure you are using the same environment on pip3 and python3