With the development of the informationization era, it has become the norm for teachers of Civics and Political Science courses in colleges and universities to assist classroom teaching through network resources. In order to further utilize network resources to make them better serve the classroom teaching of Civics and Politics courses in colleges and universities, this paper optimizes the teaching resources recommendation technology based on deep neural network. Defining the network teaching resources data as a ternary group , we put forward the research hypothesis and LSTM model, and establish the G-LSTM recommendation model for recommending the teaching resources of ideological network. The overall framework of G-LSTM model is described, and the recommendation based on G-LSTM is applied to the ideological network teaching resources recommendation. Adopt AUC, MRR and NDCG as evaluation indexes to check the performance indexes of G-LSTM model. Combined with the actual teaching of ideologic theory class, the practical effect of G-LSTM recommendation model is analyzed. 67.81% of students and 39.71% of teachers recognize each recommended online teaching resources. It shows that the improved LSTM model in this paper can further screen the ideological and political network teaching resources, and the teaching resources recommended by the model are more suitable for the teaching of ideological and political theory.