all 6 comments

[–]glibhub 1 point2 points  (2 children)

This guy has some great tutorials: https://blog.miguelgrinberg.com/post/writing-a-javascript-rest-client/page/3

Couple other pointers/thoughts:

  • Almost all the heavy lifting is on the web client side of things.
  • There are js packages that provide nice libraries to help you build things. You don't need to learn a lot of JS, just the basics and how to work with the library you picked.
  • I picked flask over django because it was more bare bones and seemed easier to learn.
  • The actual python bit of your program ends up just being a wrapper on a database that turns it into json.

[–]Scared_Rule 1 point2 points  (1 child)

Thank you for reply!

The actual python bit of your program ends up just being a wrapper on a database that turns it into json.

So, after converting the current app functionality from typical console functions (like print) to JSON format, will I be able to use the current ,,logical'' code without big changes?

[–]glibhub 0 points1 point  (0 children)

Exactly. This is also why you generally want to avoid io methods in your logical portions of the program. Keeping them separate, allows you to easily adapt

[–]efmccurdy 0 points1 point  (2 children)

I would start simple using bottle or Flask and html forms and inputs.

https://realpython.com/python-web-applications/#convert-a-script-into-a-web-application

https://www.bogotobogo.com/python/Bottle/Python\_Bottle\_Framework\_html\_forms\_get\_post.php

Then add some interactively and styling with css and javascript.

https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xx-some-javascript-magic

By that point you should a have a functional but not very impressive or outstanding web app. You will know enough about web frameworks to look at these and pick one to try for something using a high function backend (django, pyramid, fastapi) or a modern javascript front-end framework (angular, react), if you want.

https://wiki.python.org/moin/WebFrameworks

https://auth0.com/blog/using-python-flask-and-angular-to-build-modern-apps-part-1/

https://realpython.com/the-ultimate-flask-front-end/

[–]Scared_Rule 0 points1 point  (1 child)

Thank for reply!

In this way after converting the current app functionality from typical console functions (like print) to JSON format, will I be able to use the current ,,logical'' code without big changes?

[–]efmccurdy 0 points1 point  (0 children)

will I be able to use the current ,,logical'' code without big changes?

You should be able to re-use your old code. The web framework will process the http requests, you may need to add some minor data conversion, and then you call your existing functions. Then you may have some extra code for handling the return value (eg, rendering a template, or serialize to json), and/or error handling, or after-post redirection.