Dicussions

Welcome to the discussions section of the Oreoweb documentation:

Databases

Storing data and/or retrieving it from a database is a very common task to perform in a server-side web application.

Oreoweb only provide its own NoSql database layer, and probably never will. However, we do wish to integrate with a recommended solution in a foreseeable future.

In the meantime, you'll need to integrate with third-party libraries.

Querying a database is typically I/O-bound and can represent a significant part of the request processing time.

This makes asynchronous programming an ideal tool for the job, which is why this page only discusses async solutions.

No SQL

from oreoweb import oreodb

app = OreoDB()

mydb = OreoDB("./mydb.db")
mydb.set("name" , "Harish") #Sets Value
mydb.get("name")

@app.route("/")
def home(req, resp):
    resp.text = "Hello, this is a home page."

Frontend frameworks

Modern web applications typically consist of a backend and a frontend. Oreoweb is a backend framework, but it's dead simple to integrate with modern frontend JavaScript frameworks.

Guidelines

Frontend frameworks generally have their own development tooling, including command line tools, hot reload, etc. Based on this assumption, here are some recommendations:

  • In development: run 2 separate servers — one for Oreoweb, one for the frontend.

  • In production, either:

    • Serve the frontend build with Oreoweb. This may be enough for smaller-scale setups, and as shown in the react-example repo, this can be achieved by:

      1. Mounting the build directory as an extra static files directory.

      2. Serving the main index.html using templates.

    • (Recommended) Deploy Oreoweb and the frontend on two separate hosts. See also Deployment for general hints on deploying Oreoweb applications. For the frontend, please refer to your framework's instructions.

Last updated