hammies
hammies

Reputation: 1435

django static url with mezzanine and templates

I've been stuck for awhile and I can't seem to get it. Before you say python manage.py collectstatic yes, I've done that. Here's the issue: I am using one of mezzanine's solid layout. It doesn't seem like the mezzanine's files merge with the solid template layout.

On my front page, the CSS works, but if i head over to /admin page, then the css loads like this admin/static/mezzanine/some_css.css. Anything but the root main page loads the css file. So I'm guessing it's that path, but I've double checked my root path, it seems correct?

settings.py

PROJECT_ROOT = BASE_DIR = os.path.dirname(PROJECT_APP_PATH)
# PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) also tried this
STATIC_URL ='static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
# STATICFILES_DIRS = ( os.path.join(PROJECT_ROOT, "solid/static"), ) also tried this
STATICFILES_DIRS = (
    os.path.join(os.path.realpath(PROJECT_ROOT), "solid/static"),
)

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
)

urls.py

urlpatterns +=[]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

simplfied file structure

app
---app
---solid
      static
         admin
         css
         mezzanine
      templates
---static
      admin
      css
      mezzanine
manage.py

Upvotes: 1

Views: 154

Answers (1)

Arpit Solanki
Arpit Solanki

Reputation: 9931

You are missing an important thing named a slash in the begining. Put a slash in front.

STATIC_URL ='/static/'

Upvotes: 1

Related Questions