Skip to main content

package flask to use conveniently like django

Project description

Flask Api Resource

package flask to use conveniently like django


Step 1

from flask import Flask
from flask_api_resource import FlaskApiResource

app = Flask(__name__)
app.config['INSTALL_APPS'] = []  # your application app like user
api = FlaskApiResource()
api.init_app(app=app)  # this can auto scan your resource

Step 2

According to your logic to create different app

from flask_api_resource.api import BaseResource
from flask_api_resource.decorator import get

class UserResource(BaseResource):
    def get_urls(self):
        return [
            ('/detail', self.detail)
    def detail(self):
        return self.success({'id': 1})

def register(api):
    from .apis.user import UserResource

Step 3

run the Flask app server and open the

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flask-api-resource, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size flask-api-resource-0.1.2.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page