The Gemara (Shabbat 23a, Sukka 46a) and later, the Shulhan Aruch (Orah Haim 676:1) rule that three blessings are recited on the Hanukkah lights: “Lehadlik Ner (Shel) Hanukkah”, “She’asa Nissim” and “Sheheheyanu”. There is a principle in the Gemara that when it comes to performing Mitzvot which have a blessing, the blessing is first recited and then that particular Mitzvah is performed immediately. In the case of Hanukkah, the blessing of the Mitzvah is “Lehadlik Ner Hanukkah”, while the other two that accompany it are blessings of praise and of thanks. According to one opinion, including the Rama (O.H. 676:2), all three blessings should be recited before the Menora is lit.
Nevertheless, another opinion is that since only “Lehadlik Ner Hanukkah” is the blessing for that Mitzvah, and the other two are simply blessings of praise, the practice is to recite the first blessing, light the Menora and then recite the other two blessings while one is lighting. Rabbi Shem Tov Gagin (Keter Shem Tov vol. 2, § 522) explains that this was the custom in Israel, Egypt and cities in the Maghreb, including Morocco. Furthermore, the Siddur of the Rashash explains that there are Kabbalistic reasons for reciting the blessings this way. Rabbi Yaakov Hillel (Shu”t Vayashev Hayam vol. 1, § 11) supports this opinion with both simple and Kabbalistic proofs, but says that the last two blessings are only recited after the lighting the Menora is completed.
Rabbi Yehoshua Maman was known to follow the practice of reciting all three blessings and then lighting the Menora. Rabbi Shalom Messas (Shemesh Umagen vol. 4, § 74) writes that he is uncertain of what the authentic Moroccan custom is, and it appears that both approaches are both legitimate variations of performing the Mitzvah.
Summary: One custom is to recite all the blessings and then to light the Menora, while another custom is to recite the first blessing, light the Menora and then recite the other blessings as one is lighting.