If you choose to avoid chemical pesticides, you can make a deterrent spray of cayenne mixed with water. You can also make a trap solution of apple cider vinegar and dish soap. The vinegar attracts the flies; the soap makes them unable to fly away, drowning them.