Step 1: Add Postgres Database Settings in Django Project(settings.py)
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'employee', 'USER': 'employeeuser', 'PASSWORD': '12345', 'HOST': 'localhost', 'PORT': '', } } |
Step 2: Migrate your Django Project
Step 3: Check your psql shell
Step 4: Switch into your Employee Database
Step 5: Create Table inside psql shell
Step 6: Alter Owner name
Step 7: Auto Generate Models Using following command
Step 8: Output
class Company(models.Model): name = models.TextField(blank=True, null=True) address = models.TextField(blank=True, null=True)
class Meta: managed = False db_table = 'company' |