A blog by two idiots hosted at https://the-undefined-blog.herokuapp.com
To create a new user, run
flask commands create_user <username> <email> <password> <role>
For example,
flask commands create_user Pumpkin123 [email protected] grapefruit Admin
Note: use the snippet below if you wish to create a user with a password that is NOT hashed.
from application import create_app, db
app = create_app()
app.app_context().push()
db.create_all()
from application.models import User, Post, Tag
user1 = User(username="<USERNAME>", email="<EMAIL>", password="<PASSWORD>", role="Admin")
post1 = Post(title=”Post”, content=”This post belongs in tag1!”, author=user1, draft=False)
tag1 = Tag(name=”categoryname”, colour=”red”)
db.session.add_all([user1, post1, tag1])
db.session.commit()
tag1.posts.append(post1)
db.session.commit()
from application import create_app, db
app = create_app()
app.app_context().push()
db.create_all()
from application.models import User
user = User.query.filter_by(username="<USERNAME>").first()
user.role = "Admin"
db.session.commit()
- : started development
- : published blog onto Heroku
- July 22 2023: revived blog with new Heroku Eco dyno and Amazon S3 bucket, lost all images
- Hosted on Heroku with Postgres database and Amazon S3 storage
- Bootstrap frontend and Python Flask backend
- Access the admin page via
/admin
- Access the admin page via
- When installing requirements.txt locally, remove the line
psycopg2==2.9.6
, but this is needed for Heroku to work - Many spam comments
- Can only upload one image at a time
- Give an alert if the email address does not exist when trying to log in
- Give an alert if the password is incorrect when trying to log in