Fog computing emerged to meet to the needs of modern IoT applications, such as low latency, high security, etc. To this end, it brings the network resources closer to the end user. The properties of fog computing, such as heterogeneity, distribution, and resource limitations, have challenged application deployment in this environment. Smart service placement means deploying services of the IoT applications on fog nodes in a way that their service quality requirements are met and fog resources are used effectively. This paper proposes an efficient application deployment method in fog computing using communities. In contrast to previous research, the proposed method uses more factors than topological features to distribute network capacity more evenly between communities. This results in efficient use of network resources and better fulfillment of application requirements. In addition, according to our argument, using multiple criteria to prioritize applications will lead to better deployment and more effective use of resources. For this purpose, we use the number of application requests besides the deadline factor for application prioritization. Extensive simulation results showed that the proposed method significantly outperforms the state-of-the-art methods in terms of meeting deadlines, decreasing delays, increasing resource utilization, and availability by about 17, 33, 7, and 11 percent, respectively.