Flask full-stack development case (2) - Flask+Angular+Mongodb management system, creating a popular game parameter website

Background of the project

This project crawls the data of each game parameter in the PS4 game forum, displays it on the web portal, sets up user login, and can add, delete, modify and check the game content of interest. Support logged-in users to interact with comments.
The technology stack is based on Flask + Angular + Mongodb
insert image description here

data initialization

The data is based on the csv data that has been crawled. Before the project starts, check whether the current configuration file initializes the csv data to mongodb.

from flask import Flask, render_template
from flask_cors import CORS
import config
import json
from user import user
from game import game_route
from comment import comment
app = Flask(__name__)

CORS(app, supports_credentials=True)
app.config.from_object(config)
app.config['JSON_AS_ASCII'] = False
app.register_blueprint(user, url_prefix="/")
app.register_blueprint(game_route, url_prefix="/")
app.register_blueprint(comment, url_prefix="/")
app.config["SECRET_KEY"] = 'TPmi4aLWRbyVq8zu9v82dWYW1'
app.run(debug=True)


def initial_data():
    """初始化数据"""
    with open("config.json", "r") as f:
        check_status = json.loads(f.read())
    if check_status["has_db"]:
        return
    else:
        from getData import save_to_db
        save_to_db()
        with open("config.json", "w") as f:
            f.write(json.dumps({
    
    "has_db": True}))


if __name__ == '__main__':
    initial_data()
    app.run(host='127.0.0.1', port=5000, debug=True)

Home page display

The home page displays all the game information, you can bookmark the games you like, click to adjust the details
insert image description here

game collection

Click on the collection interface to view game details
insert image description here

Details

Click detail to display the specific parameter information of the game, and users who log in to the detail interface can comment. Add and delete comments are supported.
insert image description here

Add and edit

Add and edit existing games.
insert image description here

source code acquisition

Search the wechat public account "a program tree", reply the keyword "0120" to get the source code and data files.

Guess you like

Origin blog.csdn.net/Demonslzh/article/details/129211292