I want to make a website with the help of which it will be possible to change, watch, add entries to an already made database. I chose django for this. Previously i successfully connected to this tablespace
Error application:
django.db.utils.ProgrammingError: ERROR: tablespace "AAA" does not exist
Frist models.py
class svod_lic(models.Model):
bot=models.CharField(max_length=255)
def __str__(self):
return {self.bot}
class Meta:
db_table='prim'
db_tablespace="AAA"
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
},
'AAA': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'AAA',
'USER': '****',
'PASSWORD': '****',
'HOST': '192.168.0.30',
'PORT': '5432',
}
}
Second models.py with error
class ksg_npp(models.Model):
id=models.IntegerField(),
name=models.CharField(max_length=1000),
c_prof=models.IntegerField(),
smj_prof=ArrayField(
models.IntegerField()
)
KSG=models.CharField(max_length=1000)
class Meta:
db_tablespace = "AAA"
db_table = 'ksg_npp'
Honestly i dnot even know why it`s happening pls help i am desperate. I even tried to do it in another app and still this error shows up
Upd: Ok somehow now the table shows up but still, when i trying to migrate it still shows that tablespace doesn't exist. Maybe it`s because i didn't create table with django model, but just read it in already existing database.
the problem was in that i called tablesapce and put,.
Second models.py with error
class ksg_npp(models.Model):
id=models.IntegerField(),
name=models.CharField(max_length=1000),
c_prof=models.IntegerField(),
smj_prof=ArrayField(
models.IntegerField()
)
KSG=models.CharField(max_length=1000)
class Meta:
db_tablespace = "AAA"
db_table = 'ksg_npp'
Correct models.pyr
class ksg_npp(models.Model):
id=models.IntegerField()
name=models.CharField(max_length=1000)
c_prof=models.IntegerField()
smj_prof=ArrayField(
models.IntegerField()
)
KSG=models.CharField(max_length=1000)
class Meta:
db_table = 'ksg_npp'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.