How to send your lecturer a link to your Flask assignment
Ask the agent for a small web app, approve the steps it asks about, and click the link in its reply.
A common first-year assignment: build a small web app and show it working. On your laptop it runs for you and nobody else, so your lecturer needs something they can open.
This post follows one real session on awx. We asked for a Study Planner in Python and Flask, approved two steps, clicked the link in the agent's reply, and used the app. It all ran on a Small computer (0.5 vCPU, 1 GiB). The agent's replies are its own.
Step 1: describe the assignment
Start a new chat on a Small computer. Say what the assignment asks for in your own words, say where the files should go, and ask for the link at the end.
I am a first-year student. My assignment: build a small web app called Study Planner where I can add tasks with a due date, tick them as done, and delete them. Use Python and Flask, keep the tasks in a SQLite file, and put everything in ~/planner. Keep the code simple and put a short comment above each route. Start it so I can open it in a browser, and give me a link I can send to my lecturer.
We named Flask and SQLite because the assignment did. The rest was the agent's choice.
Step 2: watch it work, and approve
The agent checked whether Flask was installed, made a virtual environment so Flask stays in its own folder, installed Flask there, and wrote two files: app.py and templates/index.html. Each step is in the chat, and you can open it to see the command and what it printed.
Then it stopped and asked before starting the server.
We pressed Approve. The agent started the app and tried it, adding, ticking and deleting a test task with commands of its own. Then it asked again, this time to publish the app as a public link.
Step 3: the link in the reply
Click it and the page opens in a new tab. Or copy it and send it to your lecturer.
The reply also has a line, "On your own computer: open http://localhost:5000". That address is for the cloud computer, not your laptop, so it will not open on yours. Use the public link.
Step 4: use the app
We added three tasks with due dates and ticked one. A ticked task moves to the bottom with a line through it. Delete removes a task for good.
Everyone who opens the link sees the same list. The agent said so in its reply: tell your lecturer to expect that, and keep anything private out of the app.
Read the code before you hand it in
The agent put a short comment above each route, as we asked. This is the route that ticks a task:
# Tick or untick a task (switch done between 0 and 1).
@app.route("/toggle/<int:task_id>", methods=["POST"])
def toggle(task_id):
db = get_db()
db.execute("UPDATE tasks SET done = 1 - done WHERE id = ?", (task_id,))
db.commit()
db.close()
return redirect("/")
If a line puzzles you, ask. "Why is it 1 - done?" gets you an answer in plain words. You may be asked to explain your own code, so run it, change something small, and make sure you can say what each route does.
How long the link lasts
On the Free plan a link lasts up to one hour. When it runs out, ask the agent for a new one. The paid plan allows up to 7 days. Our test ran on an admin account, which is why the reply in the screenshot says 7 days. For a link with a name that stays, see the PHP and MySQL post.
The app runs on the computer, so if the computer stops, the app stops with it. The agent told us how to start it again: cd ~/planner && ./venv/bin/python app.py. It also said the app uses Flask's built-in server, which is fine for a demo but not for real use.
Cautions
- Check your course rules. Some courses allow AI help with a note, some limit it. Ask your lecturer before you hand in anything the agent wrote.
- Test the link before you send it. Open it in a private window or on your phone.
- Keep private things out. Anyone with the link can open the page and see every task in it.
- Keep your own copy.
awxis in early alpha. Copy the~/plannerfolder to Git or your university drive.
Keep reading
- How to test your website in a real browser with AwanBox
- How to put your PHP and MySQL assignment online
- How to see what your agent did and share it with a link
- Your final-year project shouldn't live on your laptop
Getting started
Sign in with your Google account, give your name and confirm your email. New accounts are approved by hand, and you start on the Free plan. Then open Workbench, start a chat on a Small computer, and paste your assignment. New to the terminal? Start with the Python and terminal walk-through.
Awi, signing off.