On Thursday, February 17, 2011 09:23:47 am you wrote:
> I'm still having trouble. My directory structure is:
> 
> /usr/local/www/static
> 
> +- contrib/admin/media -- symlink to django/contrib/admin/media
> 
> +- media/admin/base_site.html -- modified version of base_site.html
> 
> I've tried every combination of the following, but nothing is working:
> 

All you need here is the /usr/local/www/static  any subdirectories here should 
be served as normal, like http://localhost/contrib/admin/media

The admin template,  You do not want it here. it should be in your template 
dir see the doc below this for that.  

http://docs.djangoproject.com/en/1.2/intro/tutorial02/#customize-the-admin-
look-and-feel

> DocumentRoot /usr/local/www/static
> - does this need to be set at all?
> 

No.


> Alias /media/ /usr/loca/www/static/...
> - not quite sure which directory this should point to
> - I've tried all sensible options, but none work
> 

Should be the absolute path to where you store your project media.

> ADMIN_MEDIA_PREFIX = '/media/'
> - Does this simply have to be equal to whatever URL is used in the Alias
> directive above?
> 
 It needs to be another alias to the absolute path of the adminmedia.
> Thank you.
> 


Ok, this is a  setup I have working (when the site/backend isn't broken ;)), 
This one is meant to work with nginx as a gateway serving my media and 
proxying back to my apache config, but it should work fine without nginx. This 
is also mod_wsgi specific, but you can add mod_python settings.

  Please read the comments, domain is the domain of this box. $USER is the 
username on the system. (these removed for security reasons).


<VirtualHost *:8080>
        # basics for named based virtual hosts
    ServerName priss.domain.com
    ServerAlias domain.homelinux.org
    ServerAdmin webmas...@domain.com

         # this is the root url path.
         # I believe this can be omitted.. graham can verify or deny
    # either way it works as expected with this set
    ServerPath /

         # custom log paths.
    ErrorLog    
/home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.error_log
    CustomLog   
/home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.access_log 
combined
    
    # mod wsgi settings.
    # adjust threads per system.
         # wrap with the IfModule so I can also add mod_python directives 
         # and let apache decide what to used based on the module loaded/used.
    <IfModule mod_wsgi.c>
        WSGIDaemonProcess blog user=$USER group=$USER threads=100
        WSGIDaemonProcess pastebin user=$USER group=$USER threads=100

        # paster
                        # this is a custom pastebin project that is served on a 
                        # subpath of the main url. this comes first before the 
main site
                        # is served so that the main projects urls.py does not 
search
                        # for this path
                        # please note this is a completely different project 
served 
                        # as part of the main site.  
                        # (no control over subdomains on this box).
        #

        WSGIScriptAlias /paster 
/home/srv/$USER/web/projects/pastebin/apache/paster.wsgi

        <Directory /home/srv/$USER/web/projects/pastebin/apache/>
                                 # to make sure this runs in it's own 
interpretter.
            WSGIApplicationGroup pastebin
            Order deny,allow
            Allow from all
        </Directory>

                        # this is the main project/site served on the root of 
the urls path
.
        WSGIScriptAlias / /home//srv/$USER/gufy/domain_com/apache/gm.wsgi

        <Directory /home/srv/$USER/gufy/domain_com/apache/>
            WSGIApplicationGroup blog
            Order deny,allow
            Allow from all
        </Directory>

    </IfModule>

        ### these are the parts you want.
        
         # /media serves all my main projects media.
         # these do not conflict with WSGIScriptAlias
         # Alias has a higher precedence than WSGIScriptAlias.
         # MEDIA_ROOT = /var/www/htm/media
    #
    Alias /media /var/www/html/media
    <Directory /var/www/html/media/>
            SetHandler None
            Order deny,allow
            Allow from all
    </Directory>

         # this is the admin media.  
         # ADMIN_MEDIA_URL = "/adminmedia/"
         # serves admin media for both projects.
         # /var/www/html/adminmedia is a copy of the django admin media found 
in 
         # django/contrib/admin/media ... I'm not a fan of symlinks here. 
         # But you can.  make sure to set the right option.
    #
    Alias /adminmedia /var/www/html/adminmedia
    <Directory /var/www/html/adminmedia/>
            SetHandler None
            Order deny,allow
            Allow from all
    </Directory>

    
    # this handles all my paster projects media files.
    # like /media for the main project.
    Alias /paster/media /var/www/html/pastebinmedia
    <Directory /var/www/html/pastebinmedia/>
        SetHandler None
        Order deny,allow
        Allow from all
    </Directory>
    
</VirtualHost>


HTH

Mike
-- 
The closest to perfection a person ever comes is when he fills out a job
application form.
                -- Stanley J. Randall

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

Reply via email to