My static files are not being served. What I have verified:
settings.STATIC_ROOT is properly defined: STATIC_ROOT = os.path.join(BASE_DIR, '..', 'collectstatic/')settings.STATIC_URL is properly defined: STATIC_URL = '/static/'python manage.py collectstaticcollectstatic/ directory has the right assetscollectstatic/ directory is tracked in my git repogit push google (I am not sure if gae is using the gae repo copy for staging, or my local repo)gcloud preview app deploy app.yaml --promote -qapp.yaml is properly configured, as explained hereSpecifically:
handlers:
- url: /static
static_dir: collecstatic
- url: .*
script: myproj.wsgi.application
Still I get 404 for:
https://my-site.appspot.com/static/admin/css/base.css
Why could this be? What else can I verify?
On The logging tab of the Google Cloud Platform I see warning messages:
Static file referenced by handler not found: collecstatic/admin/css/base.css
I would say all my settings are correct though.
How can I verify if my app instance has the right assets in the right places? Is there a way of checking the filesystem structure of a running instance?
Embarassing, but the problem was a spelling error. I had:
handlers:
- url: /static
static_dir: collecstatic
And should be:
handlers:
- url: /static
static_dir: collectstatic
I'll keep this. Maybe helps somebody else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With