this is my static and media settings in setting.py
STATIC_URL = '/static/'
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
And in my project folder structures, static
and media
folders are next to each other.
So when I use this html tag
<img src="/static/pic.jpg">
Or http://127.0.0.1:8000/static/pic.jpg
, it works.
But <img src="/media/pic.jpg">
and http://127.0.0.1:8000/media/pic.jpg
doesn't.
How is that Django recognizes 127.0.0.1:8000/static/
as a valid address
But it throws Page not found (404)
when I'm trying 127.0.0.1:8000/media/
?
This is my url config
from django.conf.urls import patterns, include, url
from django.contrib import admin
from mysite.views import *
urlpatterns = patterns('',
url(r'^$', 'mysite.views.home', name='home'),
url(r'^home/', 'mysite.views.gohome'),
url(r'^admin/', include(admin.site.urls)),
)