On Nov 19, 10:32 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Nov 20, 2:10 pm, "Serdar T." <[EMAIL PROTECTED]> wrote:
>
> > hmm...I modified the root as you suggested but still the same results:
> > I get the admin page minus any stylesheets, etc.
>
> > I'm confused though: what exactly is the ADMIN_MEDIA_PREFIX prefixing?
>
> >  It seems that the setting tacks "/media" to the end of root path as a
> > way of defining where the server should search for media.
>
> > But if the "media" directory is being appended to the end of the path,
> > why is it called a prefix?
>
> Please provide a snippet of the HTML pages being served which show the
> actual URLs which are generated in the response.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml"; lang="en-us" xml:lang="en-
us" >
3<head>
4<title>Log in | Django site admin</title>
5<![if gte IE 6]><link rel="stylesheet" type="text/css" href="/media/
css/login.css" /><![endif]>
6<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/media/
css/ie.css" /><![endif]-->
7
8
9
10<meta name="robots" content="NONE,NOARCHIVE" />
11</head>
12
13
14<body class="login">
15
16<!-- Container -->
17<div id="container">
18
19
20 <!-- Header -->
21 <div id="header">
22 <div id="branding">
23
24<h1 id="site-name">Django administration</h1>
25
26 </div>
27
28
29 </div>
30 <!-- END Header -->
<<<snipped>>>


> Also indicate whether you have validated that you can access the
> static media files from nginx media site and exactly what the URLs you
> have managed to successfully access them using are.

Yup, when I turn indexing on in nginx configs, I'm able to view the
media files at the following URL subdomain:

http://media.mysite.org/

gives acess the following directory heirarchy:

../
media/
          ../
          css/                                               10-
Nov-2008 14:05                   -
          img/                                               10-
Nov-2008 14:05                   -
          js/
         <<snip>>

>
> A directory list of what is actually in:
>
>   /home/user/public_html/mysite/public

the "/media" directory is the only thing in this directory.
It is a symlink to django's admin media file, located in the following
directory:

/home/user/python/django-trunk/django/contrib/admin/media

>   /home/user/public_html/mysite/public/media
media, as stated above, is a symlink to django's admin/media directory


> would be useful as well.
>
> Graham
>
> > On Nov 19, 7:43 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > If:
>
> > >   ADMIN_MEDIA_PREFIX = '/media/'
>
> > > means that static media URLs will all be prefixed with that, then
> > > wouldn't:
>
> > >   root /home/user/public_html/mysite/public/media;
>
> > > need to be:
>
> > >   root /home/user/public_html/mysite/public;
>
> > > This is because you have location '/' on nginx mapped to this
> > > directory.
>
> > > Graham
>
> > > On Nov 20, 10:45 am, "Serdar T." <[EMAIL PROTECTED]> wrote:
>
> > > > Hello folks,
> > > > Can anyone out there offer advice on glitches in my production
> > > > environment, as well as explain the relevant settings.py in plain
> > > > English for a newbie?
>
> > > > I've been pulling my hair out for weeks trying to get an nginx reverse
> > > > proxy to serve static media while apache mod_wsgi serves up dynamic
> > > > django content. The dynamic content is being served, and I can access
> > > > the index of media files in a browser by visiting the MEDIA_URL.
>
> > > > But for some reason, media does not get served when I access the admin
> > > > backend. I get the login screen without any of the stylesheets,
> > > > javascript, etc. (and a 500 error when I try to login).
>
> > > > I haven't had any luck despite countless tweaks to MEDIA_ROOT,
> > > > MEDIA_URL, and ADMIN_MEDIA_PREFIX  (along with corresponding changes
> > > > to nginx and apache config files).
>
> > > > At the bottom of the post are my various config files. I was hoping
> > > > someone could point out whatever dumb mistake I'm making.
> > > > Additionally, if someone could explain the concepts behind the
> > > > settings.py file and how they relate back to the server config files
> > > > -- that would be enormously helpful (the django docs and countless
> > > > threads I've read on the subject don't connect the dots clearly enough
> > > > -- at least for me).
>
> > > >  I'm hoping a basic explanation might let me penetrate the problem
> > > > conceptually, so I'm not just futzing around with tweaks with no idea
> > > > what's really happening.
>
> > > > Can someone teach a man to fish?
>
> > > > ****************settings.py****************
> > > > MEDIA_ROOT = '/home/user/public_html/mysite/public/media/'
> > > > MEDIA_URL = 'http://media.mysite.org/'
> > > > ADMIN_MEDIA_PREFIX = '/media/'
>
> > > > ******************/etc/nginx/nginx.conf*************
> > > > user www-data;
> > > > worker_processes  3;
>
> > > > error_log  /var/log/nginx/error.log;
> > > > pid        /var/run/nginx.pid;
>
> > > > events {
> > > >     worker_connections  1024;
>
> > > > }
>
> > > > http {
> > > >     include       /etc/nginx/mime.types;
> > > >     default_type  application/octet-stream;
>
> > > >     access_log  /var/log/nginx/access.log;
>
> > > >     sendfile        on;
> > > >     #tcp_nopush     on;
>
> > > >     #keepalive_timeout  0;
> > > >     keepalive_timeout  10;
> > > >     tcp_nodelay        on;
>
> > > >     gzip  on;
>
> > > >     upstream webcluster {
> > > >         server 127.0.0.1:8080;
> > > >     }
>
> > > >     include /etc/nginx/sites-enabled/*;
>
> > > > }
>
> > > > *****************/etc/nginx/sites-available/mysite.org*************
> > > > server {
> > > >         listen 80;
> > > >         server_name media.mysite.org;
> > > >         access_log /var/log/nginx/mysite.media.access.log;
> > > >         location / {
> > > >                 autoindex on;
> > > >                 index index.html;
> > > >                 root /home/user/public_html/mysite/public/media;
>
> > > >         }
>
> > > > }
>
> > > > server {
> > > >         listen 80;
> > > >         server_name mysite.orgwww.mysite.org;
> > > >         access_log /var/log/nginx/mysite.django.access.log;
> > > >         if ($host !~* "^mysite\.org") {
> > > >                 rewrite ^(.*)$http://mysite.org$1permanent;
> > > >                 break;
> > > >         }
> > > >         location / {
> > > >                 proxy_passhttp://webcluster;
> > > >                 include /etc/nginx/proxy.conf;
> > > >         }
>
> > > > }
>
> > > > *****************/etc/apache2/sites-available/mysite.org**************
> > > > <VirtualHost 127.0.0.1:8080>
> > > >         ServerAdmin [EMAIL PROTECTED]
> > > >         ServerNamewww.mysite.org
> > > >         ServerAlias mysite.org
> > > >         WSGIScriptAlias / /home/user/public_html/mysite/test_app/
> > > > mysite.wsgi
>
> > > >         <Directory /home/user/public_html/mysite/test_app>
> > > >         Order deny,allow
> > > >         Allow from all
> > > >         </Directory>
>
> > > >         LogLevel debug
> > > >         ErrorLog /var/log/apache2/mysite/error.log
> > > >         CustomLog /var/log/apache2/mysite/access.log combined
>
> > > > </VirtualHost>
--~--~---------~--~----~------------~-------~--~----~
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