Thought this might help some. I have it setup so my vhost takes care of static data (which i think is the best option, or using a 2nd sever for serving static media)
My settings stuff: MEDIA_ROOT = '/web/PROJECT/media/' <- change "PROJECT" MEDIA_URL = '/' ADMIN_MEDIA_PREFIX = '/admin-media/' <- this is a link to the django admin media, the link is in the project media folder. My Vhost setting: <VirtualHost *> ServerName www.DOMAINNAME.com <- Change .. DocumentRoot /web/PROJECT/media/ <- Change to ur project media path <Location "/"> SetHandler python-program PythonPath "['/web'] + sys.path" <- change as well! PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE PROJECT.settings <- change "PROJECT" to urs. PythonDebug Off </Location> LogLevel debug ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined <Directory /web/PROJECT/media/> # Or whatever you chose above <- Change "PROJECT", Options +FollowSymLinks Order allow,deny allow from all </Directory> <Location "/admin-media/"> <- gets u the admin media from the link you created SetHandler None </Location> <Location "/website/"> <- This is in my media dir which holds the css, javascript and media for the website SetHandler None </Location> <Location "/favicon.ico"> SetHandler None </Location> </VirtualHost> so to get to my css file which is in \web\PROJECT\media\website\css \base.css i call this in my template: <link rel="stylesheet" type="text/css" href="/website/css/base.css" media="all"/> o On Feb 15, 1:59 pm, todd <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---