Homework #3
Reading → Coding → Deploy → Code-review
Reading
- Flask Sessions: https://flask.palletsprojects.com/en/1.1.x/quickstart/#sessions
- Flask cookies: https://flask.palletsprojects.com/en/1.1.x/quickstart/#cookies
- Flask login: https://flask-login.readthedocs.io/en/latest/
Coding
Preparations
- Install Python programming language v3.8.2: https://www.python.org/downloads/
- Install Flask framework with pip: https://docs.python.org/3/installing/index.html#basic-usage
Basic part
-
Create web application, which can authenticate user with password:
1.1 Listen on
localhost:5000
1.2 Render authentication form on
http://localhost:5000/
1.3 Return static images and files on
http://localhost:5000/static/<image_name>
1.4 Has secret page for authenticated users on
http://localhost:5000/cabinet
-
You are allowed to use any JS or CSS frameworks
-
You are allowed to use only Python programming language and Flask framework
-
You can hardcode pre-defined usernames and passwords inside your application
Optimal part
- Add registration function to append new users on
http://localhost:5000/register/
- Allow users logout
http://localhost:5000/logout
- You can keep usernames/passwords in global storage
Challenging part
(Part for those, who already knows all that stuff)
- Implement session storage based on files in
sessions
directory - Files should be encoded in JSON format
- Session cookies should be signed with HMAC or any other digest method
Deploy
- Register on GitHub: https://github.com/
- Join our organization: https://github.com/itmo-wad/
- You can create new personal repository or use repository for the previous tasks (but don’t remove old files, just append new directories)
- Commit and push your sources to GitHub. And don’t forget to describe shortly what have you done in
README.md
file. Use Markdown format: https://guides.github.com/features/mastering-markdown/ - (optional) Deploy you sources on Heroku or somewhere else and add link to the server to
README.md
Code-review
- Communicate in Telegram chat
- Help others to complete the assignment