over 2 years ago

While setting the timezone for a Django server, I made a stupid mistake in the settings.py file:

TIME_ZONE = 'Asia/Shanghai'
USE_TZ = True

There is nothing wrong with the parameter names and syntax. After loading up the server, Django keeps using UTC time despite the fact that I have set TIME_ZONE = 'Asia/Shanghai'

The problem is caused by placing TIME_ZONE above USE_TZ. The order of these two lines matter here. The right way to do is:

USE_TZ = True
TIME_ZONE = 'Asia/Shanghai'
← JavaScript Closure Linting React/JSX and ES6 Javascript with Eslint in Sublime Text 3 →
 
comments powered by Disqus