添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I have addressed all errors that appeared on the errors log file and now the server runs with no errors.

GET request appears on the access log when I open the website url.

My views function normally on my localhost.

I am using the default WSGI configuration file for flask.

The file "init.py" where my app is located looks like below:

from flask import Flask
from flask_login import LoginManager
from events import socketio, users
import os
app = Flask(__name__)
app.secret_key = '1234'
app.app_context().push()
file_path = os.path.abspath(os.getcwd())+"\database\database.db"
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + file_path
app.secret_key = 'e101fde772e201928228'
login_manager = LoginManager(app)
login_manager.login_view = "login"
login_manager.login_message = "You need to log in to perform this action"
login_manager.login_message_category = "invalid-notif"
socketio.init_app(app)

Any help is greatly appreciated.

I have tried accessing only paths that I've defined a view for, but they all give a 404.

Here are two views in my python files.

@app.route("/")
def home():
    page = request.args.get("page", type=int)
    per_page = session.get("per_page") or 6
    posts_paginated = Post.query.order_by(Post.date_posted.desc()).paginate(per_page=per_page, page=page)
    if page:    
        posts_paginated.page = min(posts_paginated.pages, page)
    return render_template("index.html", posts_paginated=posts_paginated)
@app.route("/members")
def members():
    members = User.query.all()
    return render_template("members.html", members=members)
              

The views are defined in a main.py file that imports app and socketio from init.py. It's also where the app is run:

if __name__ == "__main__":
    socketio.run( app, host="0.0.0.0",allow_unsafe_werkzeug=True)
        Sorry, we have had to rate-limit your feedback sending.
Please try again in a few moments... Thanks for the feedback! Our tireless devs will get back to you soon.