If your city has outlawed medical marijuana dispensaries, and you are otherwise allowed to possess and use medical marijuana under California state law, you have two options.
First, you may try to obtain medical marijuana from a dispensary in another city within California. If you elect this option, research any restrictions that the other city has about non-city residents buying from their dispensaries (call the dispensary, or contact a local lawyer experienced in state marijuana law to help you with this).
Second, you or your primary caregiver may cultivate specified amounts of medical marijuana for your personal medical use. For more information, see California Medical Marijuana Laws under the section entitled “Amounts Allowed.” And to learn more about getting help with cultivation from a primary caregiver, see the section entitled “Protection for Caregivers” in the same article.