I've edited my Django model.py with 2 new models, MyMap and CustomMap. When I migrate the local database and run a local server I can modify records via shell or the admin client.
After deploying to the AWS environment I get the following error when I try to add a MyMap or CustomMap in the admin from example.com/admin/as_app/custommap/:
ProgrammingError at /admin/as_app/custommap/
relation "as_app_custommap" does not exist
LINE 1: SELECT COUNT('*') AS "__count" FROM "as_app_custommap"
When I deploy to elastic beanstalk all migrations are auto generated and ran. I can confirm via ssh into an EC2 instance like so:
(venv)[root@ip-#### django_folder]# python manage.py makemigrations
No changes detected
I also confirmed that my changes are actually in models.py:
(venv)[root@ip-#### django_folder]# vi as_app/models.py
class MyMap(models.Model):
name = models.CharField(default='', max_length=200, unique=True)
def name_and_id(self):
return self.name + " (" + str(self.pk) + ")"
kml_file = models.FileField(upload_to='as_app/my_maps', blank=True, default='')
class CustomMap(models.Model):
name = models.CharField(verbose_name='Map Name', default='', max_length=200, unique=True)
def location(self):
return u'<a href="' + settings.BASE_URL + u'map/custom_view/' + self.name + u'">' + settings.BASE_URL + u'map/custom_view/' + self.name + u'</a>'
location.allow_tags = True
widget1 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget2 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget3 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget4 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget5 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget6 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget7 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget8 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget9 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
widget10 = models.FileField(upload_to='as_app/custom_maps', blank=True, default='')
class ExternalData(models.Model):
name = models.CharField(verbose_name='Data Name', default='', max_length=200, unique=True)
location = models.URLField()
def clickable_location(self):
return u'<a href="' + self.location + u'">' + self.location + u'</a>'
clickable_location.allow_tags = True
...
However, when I inspect the database I can see that the models are still missing:
(venv)[root@ip-#### django_folder]# python manage.py inspectdb
from __future__ import unicode_literals
from django.db import models
class AsAppExternaldata(models.Model):
name = models.CharField(unique=True, max_length=200)
location = models.CharField(max_length=200)
class Meta:
managed = False
db_table = 'as_app_externaldata'
...
Lastly via the shell I can reproduce the error I received in the admin client and confirm that other models are working fine:
(venv)[root@ip-#### django_folder]# python manage.py shell
In [1]: import django
In [2]: from as_app.models import *
In [3]: django.setup()
In [4]: ExternalData
Out[4]: as_app.models.ExternalData
In [5]: MyMap
Out[5]: as_app.models.MyMap
In [6]: ExternalData.objects.all()
Out[6]: []
In [7]: MyMap.objects.all()
/opt/python/run/venv/local/lib/python2.7/site-packages/django/db/backends/utils.pyc in execute(self, sql, params)
62 return self.cursor.execute(sql)
63 else:
---> 64 return self.cursor.execute(sql, params)
65
66 def executemany(self, sql, param_list):
ProgrammingError: relation "as_app_mymap" does not exist
LINE 1: ...app_mymap"."name", "as_app_mymap"."kml_file" FROM "as_app_my...
I've tried migrating using the --fake flag suggested here.
Also tried running sqlmigrate manually specifying my migration as suggested here.
I tried doing a lot of searching for anything related to:
django inspectdb not showing model
... and similar phrases but no luck.
Let me know if there is anything else that would be helpful to try or show.