Django第一个请求的流程
首先验证中间件中含User.objects.get(username=username)
然后大致按照如下调用过程(这里只列出调用的关键点函数,调用于被调用关系用缩进表示)
models.manager.get self.get_query_set().get( self.filter(*args, **kwargs) models.sql.query add_q add_filter self.setup_joins models.option opts.get_field_by_name(name) cache = self.init_name_map() self.get_all_related_m2m_objects_with_model() for klass in get_models() self._populate() for app_name in settings.INSTALLED_APPS: if app_name in self.handled: continue self.load_app(app_name, True)