Tim's Blog

Create a folder if not exist in Python

Snippet: import os if not os.path.exists('/path/to/folder'): os.makedirs('/path/to/folder')

How to set up image uploads in Python Flask

Set up a POST route to accept an image field: import uuid import os from flask import request, Response # specify the path where you want to keep the uploaded files IMAGE_UPLOADS = './filestore' @app.route('/upload_img', methods=['POST']) def upload_img(): if request.

Serving a static folder in Python Flask

Serving a folder named static: from flask import Flask, send_from_directory app = Flask(__name__) @app.route('/static/<path:path>') def static_assets(path): return send_from_directory('static', path) Serving a built frontend project (eg. Vue, React) In this example, the built project

How to add Vuex to Vue project

Vue 2 npm install vuex@3.6.2 --save Create file: src/store/index.js // store/index.js import Vuex from 'vuex' import Vue from 'vue' Vue.use(Vuex) const store = new Vuex.Store({ state: { count: 0 }, mutations: { increment (state) { state.count++ } } }) export default store In

How to create Vue 2 or Vue 3 project using Vite

create-vue is the recommended CLI to create a Vue project with Vite. https://github.com/vuejs/create-vue Below are the commands that ultilize create-vue to start your Vue project. Vue 3 npm init vue@3 Vue 2 npm init vue@2

Tim's Blog © 2026