Tuesday, May 24, 2011

Serving static file on Windows

Hi,


sample/
media/
js/jquery.1.6.1.min.js
css/
static/
js/jquery.1.6.1.min.js
css/

settings.py

import os
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media/')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static/')
STATIC_URL = '/static/'


urls.py


urlpatterns = patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),


http://192.168.1.141:44/static/js/jquery.1.6.1.min.js

Page not found (404)
'js\jquery.1.6.1.min.js' could not be found

Thanks

Madhu


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment