Issue
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.
Solution
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
Answered By - I'mSRJ
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.