404 when accessing resource Flask-Restful

from flask import g, request, session, render_template, flash, redirect, url_for
from flask import current_app as app

def home():
    return 'this works'

from flask_restful import Resource, Api
from app.extensions import api

class HelloWorld(Resource):
    def get(self):
        return {'Hello': 'World'}

api.add_resource(HelloWorld, '/test')  # Getting a 404 for this route on

Extensions sets up the api variable:

api = Api()

I cannot figure out why I get a 404 when trying to access an api resource?


Ok, the problem seems to be that the below ordering is wrong. I must add resources before I init the api.

api = Api()
api.add_resource(HelloWorld, '/')


api = Api()
api.add_resource(HelloWorld, '/')

This is quite strange given that e.g. SQLAlchemy needs to call init_app before it is used...


 ? Page timing out with 404 error when script runs longer than 120 seconds
 ? Getting 404 error when submitting a form
 ? JSP in /WEB-INF returns "HTTP Status 404 The requested resource is not available"
 ? Tomcat started in Eclipse but unable to connect to http://localhost:8085/
 ? Why is @font-face throwing a 404 error on woff files?
 ? Routing for custom ASP.NET MVC 404 Error page
 ? How to check if a URL exists or returns 404 with Java?
 ? Best way to implement a 404 in ASP.NET
 ? How can I create an error 404 in PHP?
 ? How to get MVC action to return 404