Hi all, I've been looked at the links here on this thread, and online for how to connect my css but the answer still aludes me. I'm not sure where the things are going wrong, so I'm going to present a dummy environments to try to go through the steps of connecting to static files.
Say I've got a django project on a mac and I want apache to serve the static files. The location and name of the project is: /Users/user_name/mysite/app If I put a directory called media in /var/www should the MEDIA_ROOT be: MEDIA_ROOT = '/var/www/media/' and the MEDIA_URL, I'm not sure what it should be. Then the httpd.conf should look like this: <Location "/Users/user_name/mysite"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On PythonPath "[/Users/user_name/mysite] + sys.path" </Location> <Location "/media"> SetHandler None </Location> <LocationMatch "\.(jpg|gif|png)"> SetHandler None </LocationMatch> And if the the css is supposed to appear in show_css.html the link ref should be: <link rel="stylesheet" href="main.css" type="text/css"> Can anyone see what is wrong? Does the media directory need to have a url path in urls.py? On Feb 4, 10:12 pm, deniz <[EMAIL PROTECTED]> wrote: > Hi, > > I am using SVN trunk version now. > > css file is located as /Users/Shared/web/mysite/media/somestyle.css > > would someone guide me throughly please? > base.html: > <link rel="stylesheet" href="/media/somestyle.css" type="text/css"> > > urls.py: > (r'^media/(?P<path>.*)', 'django.views.static.serve', > {'document_root': 'media'}), > > settings.py: > MEDIA_ROOT = '/Users/Shared/web/mysite/' > MEDIA_URL = 'http://127.0.0.1:8000/media/' > > I am new to web programming and completely lost. Please forgive my > stupid questions. > > Regards, > Deniz > > On Jan 2, 4:28 pm, Thomas <[EMAIL PROTECTED]> wrote:> Ronaldo, have a look > here:http://www.djangoproject.com/documentation/static_files/ > > > Thomas > > > On Jan 2, 3:23 pm, "Ronaldo Z. Afonso" <[EMAIL PROTECTED]> > > wrote: > > > > Hi all, > > > > I'm having some problems with Django and CSS. It seems that my templates > > > just don't load the CSS file. I'm using some think like this: > > > > <link type="text/css" rel="stylesheet" href="file.css" /> > > > > and the "file.css" is in the same directory as all my templates, but all > > > my pages are with no style. > > > So is there any special thing to do to use CSS with Django? Or can > > > anybody point me to a documentation about CSS in Django? I just found > > > one about CSS and the admin interface. > > > > Thanks in advance. > > > Ronaldo. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---