Python Forum
Forms, python, passlib and other questions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Forms, python, passlib and other questions
#1
I am trying to learn about forms and server side scripting with python. I read the w3c forms tutorial and then watched the tutorials here: https://pythonschool.net/server-side-scr...de-script/ where he shows how to capture form data, and then goes on to show how to use a MySQL DB.

So I got things working, and have apache, MySQL and MySQL connector installed and working. I can type a name in and the code checks (using a simple name lookup) if it is in the DB, and if not adds it.

So as part of this I decided to try to make a login type form, with username and password - this works, but was stored plaintext, and I wanted to go further so read about hashing, and installed passlib with pip, and also did pip install passlib[argon2].

Now if I write a program and run it locally it works fine, but when I run the localhost code it says module not found. I think it is because the cgi-bin directory is in /usr/lib/cgi-bin. Does anyone know how I can fix this?

Other questions: I have heard about SQL injection and watched a video on youtube where he showed how it works and how he could then get data out of the DB. So I thought there would be some sort of SQL validator, either server side with python, or client side with javascript, but I couldn't find one. Obviously this is all running locally but in learning I want to do it right, so do I need to worry about this with MySQL and the python MySQL connector package?

For these next questions, I don't need code, more pointing in the right direction so I know where to look to figure them out. So I have seen forms where when you hover over them, something pops up to give you info about that field. Is this javascript or come css trickery?

Another thing I was thinking about trying to implement is the distance between users, so they could enter a location, and then it would tell them the distance to another user (like online dating sites do, according to my sister who loves them!) so I wondered how this was done. Also how do sites geolocate via IP?

If you have any other tips or advice for me regarding this area of python I would be happy to hear them.

I knew I'd forget a question: I have seen sign-up forms where, when you type in a username, it checks if it is available, is this javascript or how is this done?
Reply
#2
You are looking at dead stuff like CGI and XAMPP,WAMP(for Python).
Modern web-development today in Python is done bye using eg Flask or Django.
Both of these has build web-server for local development,so no need to use XAMPP,WAMP.

I want a back story look at Why is WSGI necessary?.
WSGI is all written in Python to overcome shortcoming of CGI and other stuff.
So today is all Python web-framework build on WSGI in bottom.

Look at tutorial for Flask and Django,i have one here you can look with Flask.
Working with Flask is good start in web-development for Python,you are closer to HTML,CCS,JavaScript it's like modern way of the old CGI.
Django has a lot stuff build in even if you need it or not.
That said both are good modern and mature web-frame work for Python.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I am trying to space the registration forms using css. But it is not working. tree 0 585 Apr-11-2021, 03:31 AM
Last Post: tree
  How to fill text fields web forms Martinelli 1 1,194 Sep-25-2019, 11:14 PM
Last Post: Martinelli
  How to get data from forms? dmytruk 1 1,532 Apr-02-2019, 10:53 PM
Last Post: dmytruk
  Forms to render "Guide in steps" or not? stablepeak 1 1,410 Nov-29-2018, 10:05 PM
Last Post: nilamo
  Have a specific app need but new to Python and Have some questions shelzmike 2 2,636 Oct-14-2017, 12:54 AM
Last Post: shelzmike

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020