Closed nikulk closed 8 years ago
It's great to hear you got things going so quickly. This is exactly why we built Pinax!
Thank you for the report. We are aware of some issues between webpack and collectstatic. We are looking to resolve these issues ASAP.
@nileshbits can you post your INSTALLED_APPS
? We'd like to eliminate some possibilities.
Here you go:
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.messages",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.staticfiles",
# theme
"bootstrapform",
"pinax_theme_bootstrap",
# external
"account",
"metron",
"pinax.eventlog",
# project
"ardiff_frontend",
#my apps
'diffview',
'djproxy',
]
@nileshbits when you say that collectstatic
fails, what are you seeing? Do you get a traceback or an error message? In either case can you share it?
Ouch... I removed all those files to stabilize my build. I remember it was a post-processing issue... it couldn't post-process site.css, because it couldn't find the font files due to the /site_media/static/ in the URL.
The "failure" is not harmful to this file, since the font files should be copied to the correct folder anyway. But the collectstatic postprocessor is unable resolve the URL to find the font file, so it fails.
The main side effect is that this "failure" halts the post-processing for all files after the failure, so it could leave some files unprocessed.
@nileshbits what static files backend are you using?
@paltman The problem occurs when I use ManifestStaticFilesStorage. This is the backend that adds the hash to the filename for cache-busting. I haven't tried any other backend than what the development server uses by default, which, as you know, is much more fault tolerant and does not require collectstatic.
I see. So you shouldn't need that as webpack is handling the cache bust already.
Sent from my iPhone
On Dec 11, 2015, at 6:55 PM, nileshbits notifications@github.com wrote:
@paltman The problem occurs when I use ManifestStaticFilesStorage. This is the backend that adds the hash to the filename for cache-busting.
— Reply to this email directly or view it on GitHub.
I need it for some of my own apps, that do not use the bootstrap theme. I decided to use Semantic UI since it has a richer feature set, so all our main application pages are built with that library.
Plus, due to the setup issues and learning curve involved, I decided to not use webpack for our custom Javascript files, which are still served separately. It's a small web application with a complex algorithm that is the main focus, and it didn't seem worth the hassle of learning webpack, how to add multiple entry points, and set up the whole thing. Webpack was only handling pinax's bootstrap theme.
@nileshbits see #8
i'm about to merge this and update all starter projects and do a new release. this is a pretty big change but will/should fix a lot of issues with webpack and give you more freedom on the static build side.
Thank you @paltman ! I may not need to try it out for this project, but I'll certainly check it out on my next one. If you believe this is fixed, please go ahead and close it.
The webpack configuration provided with pinax account causes collectstatic to fail on production, specifically with respect to the font files, and the way the font files' URLs are generated.
When I run
npm run build
, I can see that the generated 'site.css' has font files references in the following manner: /site_media/static/.... This does not play well with collectstatic, which requires relative URLs within the static/dist/ folder to properly collect all the files. I tried quite a few things, but being a noob with webpack, I couldn't fix the process completely.So I generated the files one last time, and manually replaced these references in the site.css files - removed the /site_media/static/ prefix to make them relative. Now collectstatic works well. I've frozen this config for now, but you can see how painful it can be to do this replacement manually each time.
Last but not least, thanks for the great starter project! It saved me tons and tons of time - no doubt about it. I'm new to Django, and I've quite a good production website almost up in less than 2 weeks!