passenger cpanel deploy flask project 404 not found
The basic problem is that I can run the hello world app but can't make other routes work.
I followed a tutorial. Project structure is as below:
testapp
__init__.py
passenger_wsgi.py
app(folder)
--templates(folder)
--static(folder)
The codes are:
__init__.py:
import os
from flask import Flask, request, render_template, redirect, url_for
project_root = os.path.dirname(os.path.realpath('__file__'))
template_path = os.path.join(project_root, 'app/templates')
static_path = os.path.join(project_root, 'app/static')
app = Flask(__name__, template_folder=template_path, static_folder=static_path)
@app.route('/')
def index():
return 'Hello, World'
passenger_wsgi.py:
import os
import sys
import importlib.util
sys.path.insert(0, os.path.dirname(os.path.realpath('__file__')))
spec = importlib.util.spec_from_file_location("wsgi", "__init__.py")
wsgi = importlib.util.module_from_spec(spec)
spec.loader.exec_module(wsgi)
application = wsgi.app
I followed the tutorial and everything went well. Then I tried to dig deeper.
(1)
I tried to add
@app.route('/login')
def login():
return 'login page.'
when I tried to access
Please sign in to leave a comment.
Comments
0 comments