orangeduck / BuildYourOwnLisp

Learn C and build your own programming language in under 1000 lines of code!
http://www.buildyourownlisp.com/
Other
2.84k stars 392 forks source link

flask-mail new import convention #136

Closed samdixon closed 4 years ago

samdixon commented 4 years ago

Hey there, thanks for the nice course. One issue I noticed with the flask webserver is the import convention for flask-mail is using an older convention that will not successfully import on newer versions of flask.

Issue:

flask.ext.mail is a retired namespace. New namespace is flask_mail

How to reproduce:

In a fresh python 3 environment with the latest version of flask, attempt to import with the from flask.ext.mail import Mail, Message. This throws the following error:

ModuleNotFoundError: No module named 'flask.ext'

Resolution:

The easiest step to resolve would be swap the from flask.ext.mail import Mail, Message to from flask_mail import Mail, Message. This is the new convention and I have confirmed it works on my machine with a fresh Python 3, latest Flask, and Pip environment. Only issue with this is it could cause issues with your web server if you use this code for it.

Another way to resolve would be to include a requirements.txt pip file.

Thoughts on which route you would like to go? I can open a PR if needed.

Thanks!

Sam

orangeduck commented 4 years ago

Thanks Sam, and sorry for the slow reply. In fact the website doesn't actually use the mail feature any more (this was when I was e-mailing out download links to people purchasing the ebook on paypal) so the easiest way might actually be to just rip the whole e-mail stuff out.

samdixon commented 4 years ago

Makes sense to me. I've opened up a PR with changes: https://github.com/orangeduck/BuildYourOwnLisp/pull/137

It removes Flask-Mail imports as well as Paypal info. Also updated the README with references. I tested this on my end, but I would double check just to make sure I didn't remove anything important.

orangeduck commented 4 years ago

Thanks again for this.