Recently developed on a project to record the user login time and login IP functionality by testing did not find any error, then Pidianpidian of migration update the database during the migration process I stumbled login time was two in the morning and more, but my test time is 10 o'clock in the morning, a full eight hours difference, look a bit blinded by the investigation area is no problem when Django time zone and Mysql, then create a new Django project to test:
Project Creation and app creation skip directly into the theme
-
Showcase key elements of
the database field
views.py
-
Call to see if the effect
can be seen that the time difference of eight hours -
Modify some parameters of the configuration file settings.py
LANGUAGE_CODE = 'zh-hans' TIME_ZONE = 'Asia/Shanghai' USE_TZ = False
-
In the test, problem solving