# Media problems on a production server

**URL:** <https://forum.djangoproject.com/t/media-problems-on-a-production-server/36172>\
**Category:** Getting Started\
**Created:** [November 4, 2024, 10:35am UTC](https://forum.djangoproject.com/t/media-problems-on-a-production-server/36172 "2024-11-04T10:35:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VarashDev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/varashdev/32/24964_2.png) [@VarashDev](https://forum.djangoproject.com/u/VarashDev)\
**Post date:** [November 4, 2024, 10:35am UTC](https://forum.djangoproject.com/t/media-problems-on-a-production-server/36172/1 "2024-11-04T10:35:12Z")

</div>

Hi,

I created a simple Django app. It works on my local, but after I pulled it to my remote server from GitHub I have a problem - media (pictures) return not found error in a browser. Please help.

in settings.py I put

```auto
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'

```

The folder ‘media’ is in project folder (where manage.py is).

And this is my urls.py:

```auto
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('core.urls')),
    path('users/', include('users.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

```

---

<div class="post-metadata">

**Author:** ![leandrodesouzadev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leandrodesouzadev/32/8981_2.png) [@leandrodesouzadev](https://forum.djangoproject.com/u/leandrodesouzadev)\
**Post date:** [November 4, 2024, 11:25am UTC](https://forum.djangoproject.com/t/media-problems-on-a-production-server/36172/2 "2024-11-04T11:25:35Z")

</div>

Hello there!

> [@VarashDev](#):
>
> but after I pulled it to my remote server from GitHub I have a problem - media (pictures) return not found error in a browser.

That happens because the Django process only serves static/media files on development, not on production. And most of the times you wouldn’t want the Django process to do that, you want your web server (nginx,apache or other) to handle static content serving.  
You must configure your web server to serve these files.  
There are several, really up to thousands posts on this forum that explains in detail how this is done. You may want to look at some of them as a starting point, and reach out again if you’re stuck. But don’t worry if this looks challenging at first, this is one of the most confusing aspects of development, because it introduces a lot of new concepts that have nothing to do with the knowledge of python and Django itself. So don’t be affraid to do some research here in the forum to find the answers you’re looking for. One of the greatest skills of a developer is the ability to solve problems, like this one, by researching and digging into the perky details.

Here’s a good starting point.

> [@Setting up media files in production with nginx](https://forum.djangoproject.com/t/setting-up-media-files-in-production-with-nginx/18812):
>
> Hello, I’m deploying an app and everything works fine until I change the DEBUG option on the settings.py to False. My media files stop showing up on my pages. I have been in the process of try and error for a week now, searching and reading forums and I can’t seem to find the correct anwser. I understand that django does not serve media files on a production env but what is the setup then? I’ve tried a lot of different things and I can’t figure it out. Any help would be much appreciated. Here…
