Skip to content

Instantly share code, notes, and snippets.

@hmanicka
hmanicka / express-serve-static.js
Last active November 19, 2018 23:21
Serving static assets in expressjs
import express from 'express'
import cors from 'cors'
import morgan from 'morgan'
// import your API routes
const app = express()
const path = require('path')
// Get the path to your static assets somehow...
@hmanicka
hmanicka / app.py
Last active April 30, 2021 15:22
Flask-Admin: To update timestamp with timezone field with UTC
import pytz
class MyView(MyModelView):
# Display the time in user's local timezone on the List View
column_formatters =
dict(scheduledtime=lambda v,c,m,p: m.scheduledtime.replace(tzinfo=pytz.utc).astimezone(tz=pytz.timezone(config.LOCAL_TIMEZONE)))
# Display the time in user's timezone on the Edit View
def edit_form(self, obj):
form = self._edit_form_class(get_form_data(), obj=obj)