pyxley icon indicating copy to clipboard operation
pyxley copied to clipboard

pyxley in production

Open jonbma opened this issue 8 years ago • 1 comments

First of all, a huge fan of Pyxley and how easy it is to get up and running.

I'm curious when the pyxley in production portion of the tutorial/doc will be written? https://media.readthedocs.org/pdf/pyxley/latest/pyxley.pdf

I know there's a template https://github.com/stitchfix/pyxley/issues/27 and it's not yet documented.

Any guidance would be appreciated!

jonbma avatar Sep 11 '16 15:09 jonbma

Thanks! Sorry for the late reply. I plan on getting to it at some point in the near future, but I haven't had time just yet.

I have a few apps running in production and the only real difference is that I override the default route function behavior. For example, I have one app that uses a postgres backend. Instead of the default behavior that filters a dataframe that's held in memory, I query the sql database.

Imagine you have some object that lets you query the sql database. Then you could use a function like below to be the new route function. So if you had a Pie Chart in your app, instead of filtering a dataframe in the default function, it would call this other function.

    def get_pie_data(self, name, args):
        df = _sql.query("sometable", filters=args)
        return PieChart.to_json(df, self.values[name])

When I get some time, I'm going to try to come up with something a little more thorough.

nmkridler avatar Sep 23 '16 16:09 nmkridler