title: The model objects from django admin aren't connected to the backend model objects
body: <p>So I'm using a $5 digital ocean droplet using ubuntu and nginix to host a django website, I followed along this <a href="https://www.youtube.com/watch?v=BrVHwQ-SJUA&amp;t=678s" rel="nofollow noreferrer">this</a> tutorial and <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04" rel="nofollow noreferrer">this</a> guide. So a part of the guide said to run <code>gunicorn --bind 0.0.0.0:8000 myproject.wsgi</code> from the virtual env, it worked and as a test I created a highlights object to see if it would show, it did and this is what it looked like:</p>
  <p><strong>EDIT 3: Service file</strong></p>
  <pre><code>[Unit]
  Description=gunicorn daemon
  Requires=gunicorn.socket
  After=network.target
  
  [Service]
  User=apple
  Group=www-data
  WorkingDirectory=/home/apple/sanskar_handicrafts
  ExecStart=/home/apple/sanskar_handicrafts/env/bin/gunicorn \
            --access-logfile - \
            --workers 3 \
            --bind unix:/run/gunicorn.sock \
            sanskar_handicrafts.wsgi:application
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  <p><a href="https://i.stack.imgur.com/bY4H9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bY4H9.png" alt="enter image description here" /></a></p>
  <p>After which I added a gunicorn socket and completed the article till the point where it told me to run <code>sudo ufw allow 'Nginx Full'</code>, however after I ran it, first of all, the css for the admin page was gone but the bigger concern was that after I added a few extra objects from the admin panel the changes didn't seem to be noticed by my views.py as when I displayed the contents of <code>Highlights.objects.all()</code> it only showed the one from above. But the admin page does show that the objects had been successfully added. Also the github repo's media folder didn't show any of the new images in them including the one uploaded from <code>gunicorn --bind 0.0.0.0:8000 myproject.wsgi</code> they only had the images I uploaded while in local development</p>
  <p><a href="https://i.stack.imgur.com/59WbV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/59WbV.png" alt="enter image description here" /></a></p>
  <p>However when I <code>ls</code> into the media folder from my virtual env running nginix it had all the media files from the images I uploaded while in local as well as all the new ones.</p>
  <p><a href="https://i.stack.imgur.com/QB7mq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QB7mq.png" alt="enter image description here" /></a></p>
  <p>I have 2 models and this problem seems to prevail for both of them, I've tried migrations, restarting the ngnix server, and pulling and pushing to github, none have worked so far.
  Also the new images do seem to exist in the required url</p>
  <p><a href="https://i.stack.imgur.com/2Wx9A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Wx9A.jpg" alt="enter image description here" /></a></p>
  <p>Here's my models.py:</p>
  <pre><code>from django.db import models
  
  class Highlights(models.Model):
      img = models.ImageField(upload_to='highlights/')
  
  class Gallery(models.Model):
      img = models.ImageField()
  </code></pre>
  <p>and here's my views.py:</p>
  <pre><code>from django.shortcuts import render,get_object_or_404
  from django.core.mail import send_mail
  from .models import Gallery,Highlights
  
  
  h_images = Highlights.objects.all()
  g_images = Gallery.objects.all()
  
  cnt = 1
  rows = []
  row = []
  # Dividing the images into rows of 3 images per row as the maximum and creating a list of those rows
  for image in g_images:
      if cnt &lt; 3:
          row.append(image)
      else:
          row.append(image)
          cnt = 0
          rows.append(row)
          row = []
      cnt += 1
  
  if row:
      rows.append(row)
  
  # Seperating the rows into multiple pages to insure faster loading and better optimization
  max_rows_per_page = 1
  home_page = rows[:max_rows_per_page]
  divided_rows_list = []
  first = max_rows_per_page
  last = max_rows_per_page + max_rows_per_page
  curr_page = 1
  for i in range(max_rows_per_page, len(rows), max_rows_per_page):
      divided_rows_list.append(rows[first:last])
      first = last
      last += max_rows_per_page
  
  
  def home(request):
      return render(request, 'index.html',{'images':h_images})
  
  def gallery(request):
      return render(request, 'gallery.html', {'rows':home_page,'nxt':1,'prev':len(divided_rows_list)})
  
      # return render(request,'gallery.html',{'rows':rows})
  
  def nxt_pg(request,num):
      if num &gt; len(divided_rows_list) or num == 0:
          return gallery(request)
      elif num &lt; 0:
          num = len(divided_rows_list)
      return render(request, 'gallery.html', {'rows': divided_rows_list[num - 1], 'nxt': num + 1, 'prev': num - 1})
  
  </code></pre>
  <p><strong>EDIT:</strong></p>
  <p>So Ankit told me the problem was because I hadn't run collect static but I had done it so, this is what the static part of my settings.py looks like:</p>
  <pre><code>STATICFILES_DIRS = [
      os.path.join(BASE_DIR,'static'),
  ]
  STATIC_URL = '/static/'
  STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
  
  MEDIA_URL = '/media/'
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  
  </code></pre>
  <p>this is what I get when I run <code>sudo nano /etc/nginx/sites-available/myproject</code></p>
  <p><strong>EDITED:</strong></p>
  <pre><code>server {
      listen 80;
      server_name 139.59.20.1;
  
      location = /favicon.ico { access_log off; log_not_found off; }
      location /static/ {
          alias /home/apple/sanskar_handicrafts/staticfiles;
      }
  
      location /media/ {
          root /home/apple/sanskar_handicrafts;
      }
      location / {
          include proxy_params;
          proxy_pass http://unix:/run/gunicorn.sock;
      }
  }
  </code></pre>
  <p>Also I do have a static_root folder and this is what happens when I try to use collectstatic now:</p>
  <p><a href="https://i.stack.imgur.com/k7js5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k7js5.png" alt="enter image description here" /></a></p>
  <p>So I don't think it's a problem with collectstatic.</p>