You are on page 1of 3

Part 5:

what is backref

Part 6:
when registerd with the same email getting the ugly error sqlalhemy integrity error
do not the application in debug mode when deployed in production.

flask_login package
login_user is used to login

current_user will hold the name of the user who logged in

logout_user is used to logout from the web page


@login_required is a decorator which requires login and redirect to the login page
which will be redirected by loginmanager

Login_manager = https://flask-login.readthedocs.io/en/latest/

whenever the login is required the previosuly accessed page will be stored in the
args dictionary and the value if it exist redirect to the particular page
next_page = request.args.get('next')
redirect(next_page) if next_page else redirect(url_for('home'))

part 7:
User account page:
profile pciture upload
account.html ---> picture upload

Createed account form updated form:


there we validate username and email

filefield and file allowed validator for wt kind of file needs to be updated,
enctype which is used to encode the data during the post request

save_picture
logic to save the uploaded picture in the profile

Os module video

pillow package work and manipulate the image in the python

os module help in intreact underlying the os

part 8:

Create and update the posts


create a new class

abort(403)

part 9 : Pagination

sort the post by oldest and newest

part 10: email and password reset


from itsdangerous import TimedJSONWebSignatureSerializer as Serializer

s = Serializer('secret', 30)
token = s.dumps({'user_id': 1}).decode('utf-8')

Signature expired

decode.utf -----?

how to send the email

conversion if byte info to string info

Generate a app password and enable 2 factor authentication so that it will enale to
send the mail
why 2 factor authentication.
what its dangerous lib how does it work using the json web token

what is smtp how does it work


hkyxsmphririlwvj

part11 :

restructure of the code spilt the code and moduler

creating Application factory

Blurprint : diff functionality

Users blueprint

errors
500 error

why we have to
@errors.app_errorhander(404)
def error_404(error):
return render_template('errors/404.html'), 404

what is 400, 403, 500

Deploy the application:

most effort and flexible.

ufw ---- uncomplicated fire wall ?

set up few rules

ubuntu@ip-172-31-28-33:~$ sudo ufw default allow outgoing


Default outgoing policy changed to 'allow'
(be sure to update your rules accordingly)

sudo vi /etc/nginx/sites-enabled/flask_blog

ubuntu@ip-172-31-28-33:~$ sudo ufw default deny incoming


Default incoming policy changed to 'deny'
(be sure to update your rules accordingly)

ngnix and gunicorn

ngnix documentation
gunicron documenation

supervisor

stderr_logfile=/var/log/flaskblog/flaskblog.err.log
stdout_logfile=/var/log/flaskblog/flaskblog.out.log

what is stderr and stdout

nginx conf : /etc/nginx/nginx.conf


client_max_body_size 5M;

You might also like