In my Flask app, I have an issue where on a production server, datetime.now() is always inserting '2020-02-05' into my sqlite's 'date_posted' field. The system time is accurate, so I have no idea where it's getting this date. If I copy the app to another system, and run it, there are no issues. I guess my question is, where in the path of system time, python retrieving the system time, and Flask passing the information to sqlite, would I begin trying to diagnose this issue? Are there any permissions in this trail, that may be interfering.
System details, and code: Ubuntu 18.04; nginx; sqlite
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(130), nullable=False)
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.now())
...
def __repr__(self):
return f"Post('{self.title}', '{self.date_posted}')"