📐File Setup

Quickly setup your main Python file with these steps

  • First a route needs to be defined, it can be simple like this, or contain multiple routes to access multiple pages.

app = App()

@app.route('/')
def index(request):
  • You can easily add your CSS and JavaScript with just a few lines.

css_link = Tags.link().attr('href', '/static/style.css').attr('rel', 'stylesheet')
js_script = Tags.script().attr('src', '/static/script.js')

html_content = str()
  • Inside of route still add a few lines to send your Python code to phyal to render it out into something visible.

app.reload_content([html_content])
return Response(html_content, content_type='text/html')
  • Outside of your route a run function needs to be put in place.

if __name__ == '__main__':
    app.run('0.0.0.0', 5000)

Now you have completed the 🙂 Get Started section, and you can proceed to learn the simple syntax of phyal.

Last updated