I am currently working on a flask_app. This is my project structure
├── pypi_org
│ ├── __pycache__
│ │ └── app.cpython-37.pyc
│ ├── app.py
│ ├── services
│ │ └── package_services.py
│ ├── static
│ │ ├── css
│ │ │ └── site.css
│ │ ├── html
│ │ └── js
│ ├── templates
│ │ ├── home
│ │ │ ├── about.html
│ │ │ └── index.html
│ │ ├── packages
│ │ │ └── details.html
│ │ └── shared
│ │ └── _layout.html
│ ├── tests
│ ├── viewmodels
│ └── views
│ ├── home_views.py
│ └── package_views.py
├── requirements-dev.txt
└── requirements.text
I have defined the blueprint in home_views.py
from flask import render_template
from flask import Blueprint
from pypi_org.services import package_services
blueprint = Blueprint('home', __name__, template_folder='templates')
@blueprint.route('/')
def index():
test_packages = package_services.get_latest_packages()
return render_template('home/index.html', packages=test_packages)
@blueprint.route('/about')
def about():
return render_template('home/about.html')
Code for app.py is given below
from flask import Flask
from pypi_org.views import home_views, package_views
app = Flask(__name__)
def main():
register_blueprints()
app.run(debug=True)
def register_blueprints():
app.register_blueprint(home_views.blueprint)
app.register_blueprint(package_views.blueprint)
if __name__ == '__main__':
main()
When I run the app.py I get the 404 error. I'm not sure what I am doing wrong. Everything looks right.
Can someone take a look?