0

I'm learning to create flask apps and I came across an issue when setting form methods. This is the code I'm using:

@app.route("/register", methods=['GET', 'POST'])
def register():
    form = RegistrationForm()
    return render_template('register.html', title='Register', form=form)

And when I run the app I get this error:

Traceback (most recent call last):
  File "C:\Python310\lib\crypt.py", line 6, in <module>
    import _crypt
ModuleNotFoundError: No module named '_crypt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Programming\Python Projects\Flask\flaskblog.py", line 1, in <module>
    from crypt import methods
  File "C:\Python310\lib\crypt.py", line 9, in <module>
    raise ImportError("The crypt module is not supported on Windows")
ImportError: The crypt module is not supported on Windows

I tried Googling but couldn't find a proper solution. Can someone tell me how to fix this error?

davidism
  • 121,510
  • 29
  • 395
  • 339

1 Answers1

0

crypt is specifically for the type of password encryption that is used by Unix-like systems.

If you want something more generic, go with hashlib instead.

https://pythonprogramming.net/password-hashing-flask-tutorial/

hobin
  • 359
  • 2
  • 11