0

While creating the project I didn't create an app and did everything in the base project. Now I am trying to connect database to my base project(not the app)

I tried 'python manage.py makemigrations' but its showing "No changes detected".

I even tried adding my project to INSTALLED_APPS in settings.py and then trying 'python manage.py makemigrations ' but it is showing an error " for model in model_or_iterable: TypeError: 'type' object is not iterable "

I have created two models

from django.db import models

class studentlogin(models.Model):
stu_name = 
models.CharField(max_length=30,default='',null=False)
stu_email = 
models.EmailField(max_length=20,default='',null=False)
stu_password = 
models.SlugField(max_length=15,default='',null=False) 


class facultylogin():
fac_name = 
models.CharField(max_length=30,default='',null=False)
fac_email = 
models.EmailField(max_length=20,default='',null=False)
fac_password = 
models.SlugField(max_length=15,default='',null=False)

also registered the models in admin.py 'admin.site.register(studentlogin), admin.site.register(facultylogin)

I need help !!

Dcoder
  • 27
  • 6

1 Answers1

0

You will need to set up sqlite3 in the same file that you have INSTALLED_APPS by using the DATABASES = {} setting

For example:

from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

Example

Might be a duplicate

Example2

Chad
  • 40
  • 5
  • Actually I have already done this , but still I am getting this error ' TypeError: 'type' object is not iterable' – Dcoder Sep 24 '21 at 13:38