The standard view of contentment is it comes from circumstances. If you have more good things in your life than bad things, you can be content. If you have more bad things in your life, you are not content.
But I think Scripture teaches something else entirely. Contentment comes when we put our trust in God's presence and his promises. Knowing that God is with us and is working for good in all circumstances gives us contentment even in the midst of really hard circumstances. Now I know I'm not really good at being content in hard circumstances yet, but the possibility does exist.
Earlier posts about contentment