当我运行python manage.py runserver时,服务器正常启动,但在第一个请求后不久,它会从后端显示几个SQL查询并再次重新启动。
当我使用uwsgi(uwsgi --http :8000 --module myapp.wsgi
)时,它可以正常工作而没有任何问题。
这是调试信息,对我来说很好看。
DEBUG:django.db.backends:(0.001) QUERY = u'SELECT "authtoken_token"."key", "authtoken_token"."user_id", "authtoken_token"."created", "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "authtoken_token" INNER JOIN "auth_user" ON ( "authtoken_token"."user_id" = "auth_user"."id" ) WHERE "authtoken_token"."key" = %s' - PARAMS = (u'tokedn_id_here',); args=('tokedn_id_here',)
DEBUG:django.db.backends:(0.000) QUERY = u'SELECT "core_profile"."id", "core_profile"."user_id", "core_profile"."count", "core_profile"."data_store" FROM "core_profile" WHERE "core_profile"."user_id" = %s' - PARAMS = (4,); args=(4,)
DEBUG:django.db.backends:(0.000) QUERY = u'BEGIN' - PARAMS = (); args=None
DEBUG:django.db.backends:(0.000) QUERY = u'INSERT INTO "api_tracking_apirequestlog" ("user_id", "requested_at", "response_ms", "path", "data", "status_code") VALUES (%s, %s, %s, %s, %s, %s)' - PARAMS = (4, u'2016-02-04 05:42:44.004194', 0, u'/subjective.json', u'Cannot store', None); args=[4, u'2016-02-04 05:42:44.004194', 0, u'/subjective.json', 'Cannot store', None]
DEBUG:django.db.backends:(0.000) QUERY = u'SELECT "core_api"."id", "core_api"."name" FROM "core_api" WHERE "core_api"."name" = %s' - PARAMS = (u'subjective',); args=('subjective',)
DEBUG:django.db.backends:(0.000) QUERY = u'SELECT "core_api"."id", "core_api"."name" FROM "core_api" INNER JOIN "core_profile_apis" ON ( "core_api"."id" = "core_profile_apis"."api_id" ) WHERE "core_profile_apis"."profile_id" = %s' - PARAMS = (1,); args=(1,)