use {{STATIC_URL}} in place of {{MEDIA_URL}} and keep STATIC_ROOT =' ' in settings page.
refer : https://docs.djangoproject.com/en/dev/howto/static-files/ On Sat, Dec 31, 2011 at 7:42 AM, Chirdeep <chirdeep.to...@gmail.com> wrote: > Hi All, > > I am just learning Python and Django. I am able to see the webpage but > css and images are not picked up. > > Configuration as below: > > Linux Ubuntu 11.04 > Python 2.7.2 > Django 1.3.1 > > I have setup Django using VirtualEnv. I am using PyCharm and my Django > project is pointing to the VirtualEnv Django installation. > > In firebug, I am getting 404 for css and images. > > Project Structure. > > ProjectRoot > -media > -images > -stylesheets > -templates > -webapp > > urls.py > > ------------------------------------------------------------------------------------------ > from django.conf.urls.defaults import patterns, include, url > import settings > from talenthunt.web import views > > urlpatterns = patterns('', > url(r'^search-form/$', views.search_form), > url(r'^search/$', views.search), > ) > > if settings.DEBUG: > urlpatterns += patterns('', > (r'^media/(?P<path>.*)$', 'django.views.static.serve', { > 'document_root': settings.MEDIA_ROOT})) > > > settings.py > > --------------------------------------------------------------------------------------- > def rel(*x): > return os.path.join(os.path.abspath(os.path.dirname(__file__)), > *x ) > > MEDIA_ROOT = rel('media') > MEDIA_URL = '/media/' > > STATIC_ROOT = rel('static') > STATIC_URL = '/static/' > > ADMIN_MEDIA_PREFIX = '/media/admin/' > > Only pasting relevant code from settings.py > > Base.html > > ------------------------------------------------------------------------------------------ > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1" /> > <title>Organic Web Design</title> > <link href="{{ MEDIA_URL }}stylesheets/common.css" > rel="stylesheet" type="text/css" /> > </head> > > Any help will be much appreciated. > > Thanks > Chirdeep > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.