Try setting:
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
-- Try changing MEDIA_URL and MEDIA_ROOT to:
MEDIA_URL = 'http://127.0.0.1:8000/media/'
MEDIA_ROOT = os.path.join(SITE_ROOT, 'media')
That works for me on dev env as well as production.
Cheers,
On 25 January 2012 00:29, Safari <safariworldcom@gmail.com> wrote:
Of course, i don't have any errors. However css is not working. Please
help me.
main.html===============================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="/media/css/style.css" type="text/
css" />
<title> {{page_title}} </title>
</head>
<body>
<h1>{{page_title}}</h1>
</body>
</html>
settings.py===============================
import os
ROOT_PATH = os.path.dirname(__file__)
MEDIA_ROOT = ROOT_PATH + '/media/'
MEDIA_URL='/media/'
ADMIN_MEDIA_PREFIX = '/media/admin/'
urls.py===============================
import os
ROOT_PATH = os.path.dirname(__file__)
urlpatterns = patterns ( ...
, r'^media/(?P<path>.*)$',
'django.views.static.serve', {'document_root':ROOT_PATH+'/media/'}),
... )
style.css===============================
body
{
background-color:#b0c4de;
}
h1
{
font-size:x-large;
}
--
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.
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