When I use MEDIA_URL or STATIC_URL to point to /static/ currently set MEDIA_URL to /static/ and using it in a path to CSS file like:
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}css/css.css" />
It points to /static/css.css
, but trying http://localhost/static/css.css
gives 404 error.
I have in settings:
.....
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/static/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = 'D:/programming/django_projects/ecomstore/'
.....
In urls.py I have point to static like this:
url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root':'D:/programming/django_projects/ecomstore/'}
So where problem is? Why it is showing 404, do I need to create some view for static files? Or is there some thing else wrong in my settings or urls.py ? Any response will be appreciated, as I am newbie in django.
thanks in advance