django – Python Anywhere website no longer serving my products images

I have a deployed e-commerce site using pythonanywhere and the product images are no longer being served:

deployed site 404

You can visit the site to see what I mean at: www.ultimatecards5.com

When I run the project locally it works perfectly:

Local website

The code bases for both the deployed website and the local version are exactly the same.

My settings.py:

import os
from dotenv import load_dotenv
load_dotenv()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = str(os.getenv('SECRET_KEY'))

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ()


# Application definition

INSTALLED_APPS = (
    'shop.apps.ShopConfig',
    'search_app.apps.SearchAppConfig',
    'cart.apps.CartConfig',
    'stripe',
    'crispy_forms', 
    'order.apps.OrderConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize'
)

MIDDLEWARE = (
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

ROOT_URLCONF = 'perfectcushion.urls'

TEMPLATES = (
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': (os.path.join(BASE_DIR, 'shop', 'templates/'), os.path.join(BASE_DIR, 'search_app', 'templates/'), os.path.join(BASE_DIR, 'cart', 'templates/'), os.path.join(BASE_DIR, 'order', 'templates/') ), #to make the apps templates available throughout the project
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': (
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'shop.context_processors.menu_links', #adding the location of our context_processor.py file
                'cart.context_processors.counter',
            ),
        },
    },
)

WSGI_APPLICATION = 'perfectcushion.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = (
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
)


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'

''' Since we have two image fields in our models declaration so we need to put some configurations in the settings file in order to make sure the images are uploaded to the right location '''

STATICFILES_DIRS = (
    os.path.join(BASE_DIR,'static'),
    )
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') #declaring static root which is where our static files will be stored


#Stripe Settings for Payment

STRIPE_PUBLISHABLE_KEY = str(os.getenv('STRIPE_PUBLISHABLE_KEY'))
STRIPE_SECRET_KEY = str(os.getenv('STRIPE_SECRET_KEY'))


CRISPY_TEMPLATE_PACK = 'bootstrap4' #using crispy form as it applies the right bootstrap classes to the forms 

#Email Settings using Mailgun

EMAIL_HOST = 'in-v3.mailjet.com' #smpt is Simple Mail Transfer Protocol
EMAIL_PORT = '587' #this is a secured port that uses TLS(Transport Layer Security) Encryption
EMAIL_USE_TLS = True #as the port is using TLS
EMAIL_HOST_USER = str(os.getenv('EMAIL_HOST_USER'))
EMAIL_HOST_PASSWORD = str(os.getenv('EMAIL_HOST_PASSWORD'))

Perhaps the issue is the images aren’t being added to /products when I add a new item via the django admin. I just don’t understand why it works locally and was working perfectly on the deployed website and then suddenly stopped working.