简体   繁体   中英

Using Eve and Flask in one application

I want to provide REST interface and a single page JS-application for consuming the REST-service. Is there a way to do both in one python app or should I start eve-app for providing REST and flask-app for providing HTML as two processes?

The Eve instance is a Flask app. It's a subclass of Flask adding Eve-specific behavior. Use that instance as you would a Flask instance.

app = Eve()

@app.route(...)
...

If your flask app is only for serving static files, you don't even need a flask app. You may be able to directly serve static assets via Nginx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM