Home > Mobile >  Import "django.db.models" could not be resolved from source / py manage.py makemigrations
Import "django.db.models" could not be resolved from source / py manage.py makemigrations

Time:06-28

I am working on a project using django and I am using Visual Studio Code software.

In my 'store' directory i have a python package called 'tiendaonline' and the app called "gestionpedidos" where I am trying to create a a Table (DDBB)

The problem i am getting is that I cannot create table because when I try to run "py manage.py makemigrations" I can see the msg "No changes detected". Also I can see in the window called problems this msg: " Import "django.db.models" could not be resolved from source "

My setting.py is like this:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'gestionpedidos',
]

and my model is this:

from django.db import models

# Create your models here.
class Pedidos(models.Model):
    numero = models.IntegerField(max_length=100 )
    fecha = models.DateField(max_length=300 )
    entregado = models.BooleanField() 

class Clientes(models.Model):
    name = models.CharField(max_length=30 )
    direc = models.CharField(max_length=50 )
    Email = models.EmailField() 
    Tel = models.EmailField() 

class Articulos(models.Model):
    name = models.CharField(max_length=100 )
    seccion = models.CharField(max_length=300 )
    price = models.IntegerField() 

I don't know what is happening. It could give me an adress of migration like "0001_init" but is not running.

Thank you

CodePudding user response:

restart your vs code first and then activate your virtual environment if you are using. do again makemigrations and migrate if still no changes detected then delete recent migration and do it again

CodePudding user response:

Did you add folder migrations into your gestionpedidos app?

  • Related