I found both to be accurate. I had my most creative writing bouts when I was totally miserable, and once again after I had woken up to the fact that the misery, including the reasons for it, were an illusion and fully committed myself to reconnecting to the Sacred. During the intermittent period I shut down writing activities almost completely for several years. I knew nothing then, I was totally disoriented, and I saw no meaning in anything.
Art thrives on misery and suffering. Tough times produce great writers, painters, musicians etc. Art is a means of self-fulfillment.
But: true Creativity comes from the connection with our joyful center, when you act from what you intuitively know to be right and true and good. Art is a means of service.
Writing does have to make sense, not only to the reader, but to the writer as well. If this is missing from your life, forget about being creative. Don’t even try.