Skip to content

Instantly share code, notes, and snippets.

@umluizlima
Last active July 6, 2018 01:22
Show Gist options
  • Save umluizlima/3043f14c056d670daa18e28bfc5b2a68 to your computer and use it in GitHub Desktop.
Save umluizlima/3043f14c056d670daa18e28bfc5b2a68 to your computer and use it in GitHub Desktop.
import os
from subprocess import call
from flask import Flask, render_template, send_from_directory
app = Flask(__name__)
app.route('/')
def index():
return render_template('index.html')
app.route('/<int:length>')
def ruler(length):
return send_from_directory(
os.path.abspath(os.path.curdir),
call(f'dxf-ruler-generator {length}'),
as_attachment=True
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment