I recommend this approach because it works seamlessly when  
transferring between production and development:

1. Put your static files in the repository (assuming you are using one)
2.  On the production server, add these lines to the site config
     so this doesn't get used except on development boxes:

     Alias /static "/home/myproject/static"
     <Location "/static">
             SetHandler None
     </Location>

3. At the end of your primary urls.py put:
     (
         r'^static/(?P<path>.*)$',
         'django.views.static.serve',
         {'document_root': settings.MEDIA_ROOT}
     ),

4. In your settings file add:

import os
SETTINGS_FILE_FOLDER = os.path.dirname(__file__)
MEDIA_ROOT = os.path.join(SETTINGS_FILE_FOLDER, 'static')


5. I use it on all my projects so I can see the static files and  
modify them locally, but it seamlessly lets Apache serve them on the  
production server

Corey


On Jan 23, 2008, at 2:28 AM, mxl wrote:

>
> I recently deployed my dear Django on winows + apache +mod_python..
> following DjangoBook step by step everything is fine but one thing
> ---- the static file(css particularly) .
> I need press F5 constantly to refresh my no-bug page to get the css
> file down to show that page properly.
> I tried views.static.serve failed.
>  tried separate a virual-host to serve the static file sololy failed
> and completely out of any clue.
> I'm a new comer to django hope you offer some help
> ^_^
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to