8 points · by hackerews · 12y ago · 17 comments
Eventually, the other analysts wanted to use my functions for their own projects, so I tried teaching them how to execute Python from the terminal. That didn't really work.
Then I spent a day building a small app to run my script. It was valuable, but still a lot of work for something so small.
Just wondering - what do others do to share scripts with non-coders?
If people are actually getting use out of it, go back and pretty it up a bit with a Bootstrap template or whatever, it doesn't take much here to have meaningful effects on user perception. It mostly just has to be nice enough that it looks reasonably professional when people show it off in meetings, which is NOT a cutting-edge design problem.
Add more pages for more scripts as needed, and tag users with permissions so you know which scripts should be exposed to which users.
If merited, go back and add fancy features like generating PDF reports and emailing them to the head of department every week.
https://flask-wtf.readthedocs.org/en/latest/
It can also handle file uploads.
https://flask-wtf.readthedocs.org/en/latest/form.html
You'd need to define a model which describes the form fields, handle it in your view, and add it to your page template.
forms.py
from flask_wtf import Form
from wtforms import TextField, PasswordField
from wtforms.validators import DataRequired
class LoginForm(Form):
email = TextField('Email', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
views.py from forms import LoginForm
@app.route('/login', methods=('GET', 'POST'))
def login():
form = LoginForm()
if form.validate_on_submit():
email = form.data.get('email', None)
password = form.data.get('password', None)
do_login_stuff(email, password)
else:
return render_template('login_page.html', form=form)
login_page.html {% extends "base.html" %}
{% block content %}
<h3>Log in:</h3>
<form method="POST" action="{{ url_for('login') }}">
{{ form.hidden_tag() }}
{{ form.email.label }} {{ form.email }}
{{ form.password.label }} {{ form.password }}
<input type="submit" value="Log in">
</form>
{% endblock %}Internal if you have the IT resources & infrastructure for that to be reasonably painless. VPS if you need to access it from multiple public locations and don't want to expose an internal server, or if "internal server" isn't a thing where you work. Heroku if you don't know how to admin Linux or don't want to spend the time worrying about it.
They were usually limited in scope enough where I just let the script crash on most errors and just warned the users about it.
Then, I ll just Zip it, and send them the scripts along with some step by step instructions on how to execute it (with screenshots) and the results expected.. At beginning it will be hassle but on the way most documents will become common for all...
It seems like there might be a niche for a "Delphi for the web" stack of reusable components and standard backend systems.