Nik, 

You are absolutely right, that's the ticket. Of course, given that I'm not 
serving the static media from a sub domain, I can can also just use a 
relative url as well (STATIC_URL = '/static/'). 
Setting up the main/http vs. admin/https redirects/rewrites on the 
webserver (first time I've tried that) had me thinking I required the full 
url for it to work properly. This is so much easier. Thanks for that. 

Mark

On Wednesday, 8 August 2012 07:09:36 UTC-7, Nikolas Stevenson-Molnar wrote:
>
> You could use a schemeless URL for STATIC_URL. E.g: 
>
> STATIC_URL = "//static.yourdomain.com" 
>
> _Nik 
>
> On 8/6/2012 3:53 PM, Melvyn Sopacua wrote: 
> > On 6-8-2012 17:56, Mark Gemmill wrote: 
> >> I am not sure how that would work. Remember, this is a single instance 
> of 
> >> django - i.e. I'm not running the https/admin part of the 
> >> site as a separate instance and therefore have only one settings file. 
> >> 
> >> What I came up with so far was to create 2 static url settings: 
> >> 
> >> *STATIC_URL = 'https://secureded/admin/static/'* 
> >> *NON_SECURE_STATIC_URL = 'http://non/admin/static/'* 
> > Do you require the server name in STATIC_URL, meaning they're served on 
> > a different hostname? If so, you can still solve your problem with nginx 
> > rewrite module: 
> > server { 
> >         # normal server, listen params etc 
> >         location /static/ { 
> >                 rewrite ^/(.*)$ http://non/$1 last; 
> >         } 
> > } 
> > server { 
> >         # ssl, listen params, ssl params 
> >         location /static/ { 
> >                 rewrite ^/(.*)$ https://secured/$1 last; 
> >         } 
> > } 
> > 
> > Then in settings.py: 
> > STATIC_URL = '/static/' 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/a1mR6TuPvUcJ.
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