Hi,

I'm using Django 1.3 and the included staticfiles app to handle my static 
media, and Nginx as the webserver.

It's currently working, but I have a feeling my paths are more complex than 
they need to be. I was wondering if anybody could perhaps point out a better 
way to config this, or any improvements to the following.

My settings.py:

# Absolute path to the directory that holds static files.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/sites/example.com/static_media/static' 

# URL that handles the static files served from STATIC_ROOT.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/' 

# URL prefix for admin media -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/";, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/' 

# A list of locations of additional static files
STATICFILES_DIRS = ()

My /etc/nginx/sites-available/example.com file:

server {
  listen 80;
  server_name www.example.com;
  rewrite ^/(.*) http://example.com/$1 permanent;
}
server {
  listen 80;
  server_name example.com;
  access_log /sites/example.com/logs/access.log;
  error_log /sites/example.com/logs/error.log;
  location /static {
    root /sites/example.com/static_media;
  }
  location / {
    proxy_pass http://127.0.0.1:8000;
  }
}

My static media is collected inside of 
/sites/example.com/static_media/static - I'm not sure why I need two layers 
of static directories, but I couldn't see a way around this (although 
I'm undoubtedly missing something obvious here).

Also, any recommended changes to Nginx config?

Cheers,
Victor

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