Having a credit card doesn't necessarily make it easier to qualify for a mortgage. The question just isn't that simple.
If you have a credit card, but misuse it, have frequent late payments, or have a high percentage of your available credit frequently used, it will drive your creditworthiness/credit score down. On the other hand, if you use a credit card responsibly, pay it off in full every month on time, it will generally enhance your creditworthiness and drive your credit score up.
That's not at all to suggest having multiple credit cards makes things even better - in fact, just the reverse. Too many open, active credit card accounts can be seen as a potential risk for a sudden burst of unwise use, with the availability of so much credit. And that use is also measured against your income.
If you have little to no debt history other than student loans, a properly used credit card can a) enhance your ability to qualify for credit, and b) enhance your chances to get the most favorable rate/down payment combination.
Before you apply for a mortgage, take a few minutes and obtain your own credit report and get your FICO score. Anything in the 700's runs from good to excellent; above 800 is exceptional. If you get into the 600's, it gets iffier. Younger individuals with limited payment history can sometimes generate an artificially high FICO score even with little to no actual long-term debt repayment history. That's when lenders look at length of credit and age to determine whether that score might merit an asterisk.
Having only student loan debt as your history should not be an obstacle in getting a mortgage; it might, however, not afford you the best available rates. Getting a credit card and using it wisely, eg paying it 100% off every month, will, over time, enhance your credit history.