WebFaction
Community site: login faq

Hey guys, I'm trying to retrieve all the css/jquery from my static_media app from my regular media app. Here's my settings.py file:

MEDIA_ROOT = '/home/oneadmin/webapps/static_media/static'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = 'http://oneadmissions.com/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/home/oneadmin/webapps/static_media/static/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = 'http://oneadmissions.com/media/'

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

# Additional locations of static files
STATICFILES_DIRS = (
    #'/home/oneadmin/webapps/oneadmin/oneadmin/static/',
    '/home/oneadmin/webapps/static_media/static/',
    '/home/oneadmin/webapps/static_media/static/jquery/',
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

asked 13 Jun '11, 19:47

oneadmin
111
accept rate: 0%

edited 13 Jun '11, 21:27

ryans ♦♦
5.0k93160

This looks correct -- your default.css file, for example, is available at http://oneadmissions.com/media/default.css

(13 Jun '11, 21:36) ryans ♦♦

First, it's not mentioned if you are using Django for this, but the code block certainly looks cut/pasted from Django's files. (Maybe add a Django tag?)

Second, you don't mention the specific problem or error you're getting. However, if you are having problems with templates not evaluating the {{ STATIC_URL }} variable, note that the STATIC_URL variable will only be available in templates that were passed a RequestContext, which is where the context processor adds the variables.

One way to check, is add url = {{ STATIC_URL }} to one of your HTML template files, and see if it's got the right variable.

If not, it might also be due to missing a context processor - you would need to add django.core.context_processors.static to your TEMPLATE_CONTEXT_PROCESSORS setting. It's supposed to be there by default in Django 1.3, but still...

permanent link

answered 16 Jun '11, 11:06

Cyclops
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×13
×12
×4

question asked: 13 Jun '11, 19:47

question was seen: 3,766 times

last updated: 16 Jun '11, 11:06

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM