Skip to content

ling67/Web-Application-Blog-Website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Web-Application-Blog-Website

Describption

  • This project mainly use flask to implement the Blog Website. A blog is a type of website that is updated regularly with new content. Most blogs contain short, informal articles called blog posts. In our project support lots of features: User's register and login, post blog, edit blog, comment the blog, follow other users.
  • In this Blog Website we use Flask framework to implement. Flask is a micro web framework written in Python, it is Easier to use for simple cases.

Related technology

  • Front end: html, css
  • Back end: Flask, REST API
  • Database
  • Security: Token Authentication

Design

modules design

  • User Authentication
  • User Role
  • User Profiles
  • Blog Posts
  • Followers
  • User Comments

Database design

image

How to run the project

Step 1. download the repo.

$ git clone https://github.com/miguelgrinberg/flasky

Step 2. go to project folder

$ cd flasky

Step 3. set virtual environment

$ python3 -m venv venv

Step 4. activate virt. environment

$ . venv/bin/activate

Step 5. install requirements and dependencies

$ pip install -r requirements/prod.txt

Step 6. -export environ. variable

$ export FLASK_APP=flasky.py

Step 7. -set database and migrations.

$ flask db stamp head
$ flask db migrate
$ flask db upgrade

Step 8. - run app

$ flask run

Then

Step 9. Solve can not receive the comfirm email problem

Now after you register, if you do not receive the confirm link, you have two ways to solve it. I think it because the google has not provide service.

  • Method 1: change the database directly, set your user as confirmed statue manually.
$ sqlite3 data-dev.sqlite
$ UPDATE users SET confirmed=1 WHERE id=1;

Then re-run app

$ flask run
  • Method 2: set your email and application password manually when you run the project.(how to set application password see Appendix οΌ‰
$ export MAIL_USERNAME=********
$ export MAIL_PASSWORD=********
$ export FLASK_ADMIN=*********
$ flask run

Then

Now you can receive the comfirm email and login, but you cannot post the blog.

Step 10. change the user role in database manually

sqlite3 data-dev.sqlite
update users set role_id = 3 where id = 1;

Now, you can post your blog.

User Interface Presentation

  • Register and Login

image

  • User profile Edit

image

  • Post and Edit Blog

image

Appendix

How to set a App Passwords: https://support.google.com/accounts/answer/185833.

  • step1: Setting a App Passwords.(eg. If you use visual studio code, setting application:visual studio code, password: google automatic generate)
  • step2: Use the gmail account and App passwords in your code.
  • step3: Run the code in visual studio code.

Detail Introduction

Blog_Website_Ling_Chen

About

This project mainly use flask to implement the Blog Website. πŸ§πŸ‘©β€πŸŽ“πŸ€“

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published