djangomezzaninedjango-modeltranslation

Django static files redirecting to URL with language code


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.


Solution

  • 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