Where are all the wagtail admin assets?

1,359 views
Skip to first unread message

Christopher Reid

unread,
Mar 22, 2015, 6:13:40 PM3/22/15
to wag...@googlegroups.com
Hey, I've got wagtail set up on an ubuntu server running behind an nginx proxy pass.

In my nginx settings I routed /static/ to the static folder of my wagtail project and now the basic stylesheet is loading so the admin has color and structure, but all the rest of the admin resources are missing.

It is quite a large list, but it includes things like "http://nomadicamagazine.com/static/wagtailadmin/js/core.js"

UPDATE:

I found the files and I've been manually adding them to my static folder which is a huge inconvenience, especially because there's some I can't find. I'm assuming there's a better way to include all the admin assets?

Karl Hobley

unread,
Mar 22, 2015, 6:30:20 PM3/22/15
to wag...@googlegroups.com
Hi Christopher,

Is DEBUG set to False?

Have you run the compress management command?

Thanks,

Karl

Christopher Reid

unread,
Mar 22, 2015, 6:36:07 PM3/22/15
to wag...@googlegroups.com
No, DEBUG is True... I just started the project.

And, no, I have not run the compress command, what is it meant to do?

Karl Hobley

unread,
Mar 23, 2015, 5:48:02 AM3/23/15
to wag...@googlegroups.com
Also, have you run "collectstatic"? This copies all the static files to one directory that you can serve with nginx.

When DEBUG is set to False, you also need to run "compress" after "collectstatic" which compiles and bundles wagtails js and css files.

Matthew Westcott

unread,
Mar 23, 2015, 6:36:37 AM3/23/15
to wag...@googlegroups.com
Hi Christopher,

Running a Django development site on a 'real' web server like nginx is a bit non-standard, so there are a few hoops to jump through if you're going that route instead of ./manage.py runserver.

Normally, runserver would add in some extra logic to serve your static files from a consistent URL (specified by STATIC_URL, usually '/static/') even though the files themselves are located in various app-specific locations. To include this logic when you're not using runserver, add in one of the code snippets detailed here:
https://docs.djangoproject.com/en/1.7/ref/contrib/staticfiles/#static-file-development-view

However, be aware that this isn't suitable for production use. In production, you would run './manage.py collectstatic' to copy all of the static files to the location specified by STATIC_ROOT (usually 'static/' at the top-level of your project) - essentially what you're doing manually at the moment - and set up nginx to serve the '/static' URL from there.

(For Wagtail's own apps, there's an extra step in the chain: we use Django Compressor <http://django-compressor.readthedocs.org> to compile SASS to CSS, and - when DEBUG is False only - compress the CSS/JS into a single file. You probably don't need to worry about that detail right now - it just means that Wagtail's CSS ends up in the 'CACHE' directory under STATIC_ROOT, where it should be picked up by one of the mechanisms above.)

- Matt
Reply all
Reply to author
Forward
0 new messages