title: Images in Django aren't loading even though they're stored locally
body: <p>With the code I have currently, my images used to load but now they don't and I can't figure out why. Within my Artist model, I have included an ImageField. This lets me upload an image and store it in a directory called 'artists' in my media directory. </p>
  
  <pre><code>class Artist(models.Model):
  name = models.CharField(max_length=40)
  genre = models.CharField(max_length=20)
  location = models.CharField(max_length=20)
  bio = models.TextField()
  photo = models.ImageField(upload_to='artists', null=True, blank=True)
  
  def __str__(self):
      return self.name
  </code></pre>
  
  <p>As you can see below, my image 'fontaines.png' has been uploaded and stored in /media/artists/.</p>
  
  <pre><code>├── db.sqlite3
  ├── manage.py
  ├── media
  │   ├── artists
  │   │   └── fontaines.png
  ├── mysite
  │   ├── __init__.py
  │   ├── __pycache__
  │   │   ├── __init__.cpython-38.pyc
  │   │   ├── settings.cpython-38.pyc
  │   │   ├── urls.cpython-38.pyc
  │   │   └── wsgi.cpython-38.pyc
  │   ├── asgi.py
  │   ├── settings.py
  │   ├── static
  │   │   └── main.css
  │   ├── templates
  │   │   └── base.html
  │   ├── urls.py
  │   └── wsgi.py
  └── pages
      ├── __init__.py
      ├── __pycache__
      │   ├── __init__.cpython-38.pyc
      │   ├── admin.cpython-38.pyc
      │   ├── apps.cpython-38.pyc
      │   ├── forms.cpython-38.pyc
      │   ├── models.cpython-38.pyc
      │   ├── urls.cpython-38.pyc
      │   └── views.cpython-38.pyc
      ├── admin.py
      ├── apps.py
      ├── forms.py
      ├── migrations
      │   ├── 0001_initial.py
      │   ├── 0002_artist.py
      │   ├── __init__.py
      │   └── __pycache__
      │       ├── 0001_initial.cpython-38.pyc
      │       ├── 0002_artist.cpython-38.pyc
      │       └── __init__.cpython-38.pyc
      ├── models.py
      ├── templates
      │   └── pages
      │       ├── artist.html
      │       ├── home.html
      │       ├── login.html
      │       ├── page.html
      │       ├── profile.html
      │       ├── signup.html
      │       ├── upload.html
      │       └── venue.html
      ├── tests.py
      ├── urls.py
      └── views.py
  </code></pre>
  
  <p>So all is looking good so far, but when I run the server locally, it says this in my terminal on the page where the image should be displaying: </p>
  
  <pre><code>Not Found: /media/artists/fontaines.png
  [19/Apr/2020 15:32:01] "GET /media/artists/fontaines.png HTTP/1.1" 404 1759
  </code></pre>
  
  <p>I've tried to figure out why the image won't load but I just can't crack it. Please help if you can, thanks.</p>
  
  <p>EDIT:
  Below is my urls.py file</p>
  
  <pre><code>from django.conf.urls import url
  from django.contrib import admin
  from django.conf import settings
  from django.conf.urls.static import static
  
  from . import views
  from django.urls import path, include
  
  urlpatterns = [
      url(r'^signup$', views.signup, name='signup'),
      url(r'^login$', views.user_login, name='login'),
      url(r'^logout$', views.logout_request, name='logout'),
      url(r'^profile$', views.profile, name='profile'),
      url(r'^artist$', views.artists, name='artist'),
      url(r'^venue$', views.venues, name='venues'),
      url(r'([^/]*)', views.home, name='home'),
  ]
  
  if settings.DEBUG:
      urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <p>Below is my settings.py file</p>
  
  <pre><code>import os
  
  # 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/3.0/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = '$b4y%d7(x*rhpqo_#t9k)c5ppvrgwmco%q-v46mfdo!31ksly*'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  ALLOWED_HOSTS = ['127.0.0.1']
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'pages.apps.PagesConfig',
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  ]
  
  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 = 'mysite.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [os.path.join(BASE_DIR, 'mysite/templates')],
          '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',
              ],
          },
      },
  ]
  
  WSGI_APPLICATION = 'mysite.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
          'USER': 'affix',
          'PASSWORD': 'robbrennan',
          'HOST': '127.0.0.1',
          'PORT': '5432',
      }
  }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/3.0/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/3.0/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/3.0/howto/static-files/
  
  STATIC_URL = '/static/'
  
  STATICFILES_DIRS = [
      os.path.join(BASE_DIR, 'mysite/static'),
  ]
  
  LOGIN_REDIRECT_URL = '/'
  
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  
  MEDIA_URL = '/media/'
  </code></pre>
  
  <p>Below is my artist.html file:</p>
  
  <pre><code>{% extends 'pages/page.html' %}
  {% load static %}
  {% block content %}
      &lt;h1&gt;AFFIX&lt;/h1&gt;
      &lt;title&gt;AFFIX - Artists&lt;/title&gt;
      &lt;h2&gt;&lt;i&gt;// Browse Artists on AFFIX //&lt;/i&gt;&lt;/h2&gt;
      &lt;br&gt;
      {% for artist in artists %}
      &lt;div id="container"&gt;
          {% if artist.photo %}
              &lt;img src="{{ artist.photo.url }}" alt="{{ artist.name }}" style="width:360px; float:right; margin-left: 40px; margin-bottom: 40px;"&gt;
          {% else %}
              &lt;p1&gt;No Photo Uploaded&lt;/p1&gt;
          {% endif %}
          &lt;h3&gt;{{ artist.name }}&lt;/h3&gt;
          &lt;p class="a"&gt;&lt;i&gt;Submitted By {{ artist.author }} on {{ artist.date_posted|date:"F d, Y" }}&lt;/i&gt;&lt;/p&gt;
          &lt;p class="a"&gt;&lt;b&gt;Genre:&lt;/b&gt; {{ artist.genre }}&lt;br&gt;&lt;b&gt;Location:&lt;/b&gt; {{ artist.location }}&lt;/p&gt;
          &lt;details&gt;
              &lt;summary&gt;Expand&lt;/summary&gt;
              &lt;p class="a"&gt;{{ artist.bio }}&lt;/p&gt;
          &lt;/details&gt;
      &lt;/div&gt;
      &lt;br&gt;
      {% endfor %}
  &lt;br&gt;
  {% endblock content %}
  </code></pre>