Video Demo: https://youtu.be/mSadNh9qSn4
The QR Code Generator is a simple website for the user to create an QR Code
image for a desired link url, to do that, first you need to create an account on the
website, you can't use a username that already exists in the database.
After creating your account you can login and be prompted with a form to submit you URL,
when you submit an URL you get a QR Code for that URL provided and you can scan it with a
cellphone or something else.
Also, there is a history page that has all the QR Codes an user generated and users
cannot generate 2 qr codes for the same URL.
In the source code there is the app.py file, in which are implemented all th application
views, such as Login, Register, Index, Logout and History.
The Login view is a method to log the user and add it to the session, so that if the session
is still up the user doesn't need to login again.
The register view is a method to register the user and add it to the database, it is not possible to create
two users with the same username, and the user is only created once the password and the password confirmation
are the same.
The index view is a login required view that displays a form to the user to write an URL and generate a QR Code for
that URL, the QR Code is displayed under the form. The same user cannot generate two QR Codes for the same URL,
the QR Code image is stored in the local storage of the machine running the code, on the static/img directory, and
also in the database, with the link as text and the image as a BLOB.
The history view displays all the QR Codes generated by the user in the session, with two columns, one for the URL
itself and another for the QR Code image. It uses the QR Codes stored in the img directory to display de list of
QR Codes.
a
The Logout view clears the session and logouts the user.
The helpers.py file contains all the helper functions utilized in the app, these are, apology, login_required and
writeTofile.
The writeTofile method is the method that stores the QR Code generated in the img directory. By using file
manipulation to write the images in the correct files.
The apology method handles the errors by displaying a page with the error that was raised and the code retrieved from
the response.
The login required method handles the pages and only displays the page content if the user is logged in.
The templates folder holds all the html code for the pages in the application, such as the about, apology, history, index, login and register pages. It also has the layout of the pages.
The static directory contains all the css code and the img directory, which contains all the QR Code generated by the user.