title: Django media files not loading
body: <p>I have a <code>users</code> app, <code>profile</code> is a model created in its <code>models.py</code>.The <code>image</code> is present in <code>/media/profile_pics/</code> but even after giving the full path in <code>src</code> it is not loading. I cannot figure out why.Adding the relevant files below.</p>
  
  <blockquote>
    <p><code>models.py</code></p>
  </blockquote>
  
  <pre><code>from django.contrib.auth.models import User
  
  from django.db import models
  from django.contrib.auth.models import AbstractUser
  
  
  class profile(models.Model):
      user = models.OneToOneField(User, on_delete=models.CASCADE)
      image = models.ImageField(default='media/default.jpg', upload_to='profile_pics')
  
  
  def __str__(self):
      return f'{self.user.username} Profile'
  </code></pre>
  
  <blockquote>
    <p><code>profile.html</code></p>
  </blockquote>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  {% extends 'base2.html' %}
  {% load crispy_forms_tags %}
  {% load static %}
  
  
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;profile&lt;/title&gt;
  &lt;/head&gt;
  {% block content %}
  &lt;body style="margin-left: 300px"&gt;
  &lt;div class="content-section"&gt;
      &lt;div class="media"&gt;
          &lt;img class="rounded-circle account-img" src="{{ user.profile.image.url }}"&gt;
          &lt;img class="rounded-circle account-img" src="E:\py-projects\hello-world\media\profile_pics\profile1.png"&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  {% endblock %}
  
  &lt;/html&gt;
  </code></pre>
  
  <blockquote>
    <p><code>settings.py</code></p>
  </blockquote>
  
  <pre><code>STATIC_URL = '/static/'
  
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  MEDIA_URL = '/media/'
  print(MEDIA_ROOT)
  
  STATICFILES_DIRS = [
  os.path.join(BASE_DIR, "static"),
  
  ]
  </code></pre>
  
  <blockquote>
    <p><code>urls.py</code>(the main urls.py, not of app <code>users</code>)</p>
  </blockquote>
  
  <pre><code>from django.contrib import admin
  from django.urls import path, include
  from users.views import profile
  from django.conf import settings
  from django.conf.urls.static import static
  
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('', include('users.urls'), name='index'),
      path('profile/', profile, name='profile'),
  
  ]
  
  if settings.DEBUG:
      urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  </code></pre>