I've put my django project into production. Every time a add an admin model it does not update and show on my admin panel. The migrations and collectstatic commands are all going through fine. I have tried to source a fix but I just can't get it to work. Works completely fine in local server.
Here is my code although:
models.py
class PostImage(models.Model):
image = models.ImageField(null=False, blank=False, upload_to="images", default="default.png")
image_title = models.CharField(max_length=100, null=False, blank=False, default="")
def __str__(self):
return self.image_title
class BlogPost(models.Model):
blog_title = models.CharField(max_length=255, null=True, blank=True)
blog_article = QuillField(null=True, blank=True)
blog_image = models.ImageField(null=True, blank=True, upload_to="images", default="default.png")
blog_date = models.DateField(auto_now_add=True)
def __str__(self):
return self.blog_title
class EnterImage(models.Model):
enter_image = models.ImageField(null=True, blank=True, upload_to="images", default="default.png")
enter_image_title = models.CharField(max_length=100, null=False, blank=False, default="")
def __str__(self):
return self.enter_image_title
class QuillPost(models.Model):
content = QuillField()
def __str__(self):
return self.content
class AboutMe(models.Model):
about_image = models.ImageField(null=True, blank=True, upload_to="images", default="default.png")
about_image_title = models.CharField(max_length=100, null=False, blank=False, default="")
def __str__(self):
return self.about_image_title
urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('martinhensonphotography.urls')),
]
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.MEDIA_ROOT)
admin.py
from django.contrib import admin
from . models import PostImage, EnterImage, BlogPost, QuillPost, AboutMe
# Register your models here.
admin.site.register(PostImage)
admin.site.register(BlogPost)
admin.site.register(EnterImage)
admin.site.register(QuillPost)
admin.site.register(AboutMe)
APPS
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'martinhensonphotography.apps.MartinhensonphotographyConfig',
'crispy_forms',
'django_quill',
'ckeditor',
'ckeditor_uploader',
You likely need to give whatever user you are using in production permission to view / list the new models in your admin view