So hello people,
Basically... I have a website and some python code that I have just written out. And I was wondering, if possible I could implement that python code into my website.
So, like my python code is a password generator. Is there any way to put that into a js onclick function or just in a website. Or, will I have to write out the code but in js instead?
I am not using node.js
CodePudding user response:
It is possible to use python with web-development! I am not sure who you would have hosting it, but you can have the pages served using the python code. If you use something like word press, they have an API that you can include into your python code. Here is a link on the WordPress API with more information https://adaptabiz.com/how-to-run-python-scripts-on-wordpress/
I would recommend looking into your specific server and see what their support protocol is for python code!
CodePudding user response:
Directly executing python code on click of the button in the browser isn't possible. So the quicker option would be to just translate that to js
However if you still want to use python, you can write that python code in an API and then call that API from your website using JS.
Here are some options if you want to make APIs with python
- Django
- Fast API
- Flask