The invention discloses a code generating method and device. The code generating method comprises the following steps: receiving an executing instruction input by a user, recalling a process file and a configuration file according to the executing instruction, wherein the process file is pre-defined; reading information in the configuration file on the basis of the process file, and successively reading at least one code template in a pre-defined template file; and generating a corresponding code file according to the code templates. The pre-defined process file, the pre-defined template file and the configuration file which can be configured according to demands of the user are adopted, and normative code files which execute corresponding tasks are generated on the basis of the demands of the user. On one hand, the workload of code developers is reduced, time and effort are saved, and the working efficiency is improved; and on the other hand, the problem that codes of various application modules of a system are not unified or normative enough is solved.