Coder Social home page Coder Social logo

problem running the basic app about pyxley HOT 2 CLOSED

stitchfix avatar stitchfix commented on July 21, 2024
problem running the basic app

from pyxley.

Comments (2)

nmkridler avatar nmkridler commented on July 21, 2024

Thanks Andrea!

Apologies, I haven't had a chance to update that doc yet. I've been trying to move to something more shiny-like that doesn't require all the boilerplate of starting a flask app.

The examples are all much more streamlined now. I wrote a gist
to cover some of the changes. Originally I was using PyReact to transpile the jsx code into javascript at runtime. Then PyReact was deprecated, so I introduced some wrappers for webpack and npm to build a javascript bundle. I felt like this was a big pain and a huge barrier to entry, so I've been thinking about how to rework it. What I settled on was including the basic components to get an app running.

If you look in the plotly example under project/__init__.py this is what you will see. I've included a simple index.html in the latest version and a javascript bundle. The locations are provided in the default_static_path and default_template_path functions. There's a file in the directory called buildui.py that does the normal pyxley stuff of creating a UILayout. Instead of writing a bunch of templated javascript file, the app just sends the props as JSON.

from os import path
from buildui import get_layouts

from pyxley.utils import create_app, default_static_path, default_template_path

# create the flask app
here = path.abspath(path.dirname(__file__))
app = create_app(here, default_static_path(), default_template_path())

# build the layout
get_layouts(app, here+"/fitbit_data.csv")

if __name__ == "__main__":
    app.run(debug=True)

If you want to do something more custom and build your own javascript bundle, I suggest looking at the tests folder. I've made an app that renders all of the widgets in different tabs.

I'll try to get to updating the documentation soon. Sorry for the confusion!

from pyxley.

disimone avatar disimone commented on July 21, 2024

Hi,

thanks a lot for the reply. I can fully agree on the "big pain" argument :)

The example you mention looks indeed a lot better, and it runs without problems.

from pyxley.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.