-1

I'm using Mezzanine 4.1.0 with Django 1.9.12 and django-modeltranslation 0.1.2.

All of my static files are getting redirected as if they were pages:

"GET /static/js/bootstrap.js HTTP/2.0" 301 0
"GET /static/js/bootstrap.js/ HTTP/2.0" 302 0
"GET /en/static/js/bootstrap.js/ HTTP/2.0" 404 6960

Has anyone seen this before? It only just started happening, for no apparent reason.

ki9
  • 5,183
  • 5
  • 37
  • 48
  • I think I figured it out. It only happens when `DEBUG = False`. Probably need to check [the docs](https://docs.djangoproject.com/en/1.9/howto/static-files/deployment/). – ki9 Feb 28 '17 at 21:18

2 Answers2

0

That was it. All I had to do was set STATIC_ROOT.

STATIC_ROOT = '/path/to/staticfiles/'

This should have been obvious, but I couldn't find anything when googling the problem. Hopefully this helps others.

ki9
  • 5,183
  • 5
  • 37
  • 48
0

I started running into this problem again, and returned to the docs:

Configure your web server to serve the files in STATIC_ROOT under the URL STATIC_URL. For example, here’s how to do this with Apache and mod_wsgi.

With caddy, I changed my Caddyfile from this:

example.com {
    proxy / localhost:42069 {
        transparent
    }
}

to this:

example.com {
    root /path/to/project
    proxy / localhost:42069 {
        transparent
        except /static
    }
}

where 42069 is the port on which the project is listening.

source

ki9
  • 5,183
  • 5
  • 37
  • 48