Package: webpy-framework
WebPyA web framework built on top of Flask that allows you to add filesystem routes (in theroot/folder of your project directory). Install it withpip install webpy-framework. Docs are locatedhere.CommandsCreating your projectwebpy new {proj-name}- Create a new projectwebpy route {route-name}- Create a new filesystem route (this must be underroot/)Deploying your projectwebpy run- Run this in the project dir to start your app using Flaskwebpy build- Package the program into abuild.pyfilewebpy compile- Package the program into abuild.pycfilewebpy buildpyx- Compile the.pyxfiles into.pyfiles -- automatically runs through thebuild,compile, andruncommandswebpy buildmd- Transpile all Markdown files to HTMLWebPy allows developers to use just a minimal amount of Python (the bare minimum needed) for their web apps while also allowing for the full functionality of Flask. Take a look atwebpy-appfor example, where the majority of the codebase is HTML and JS while still allowing Flask to be fully utilized. WebPy web servers can also be compiled to standalone exectuables by compiling the output ofwebpy buildwith a tool such as Nuitka.Your First WebPy ApplicationStart withwebpy new myfirstproject. Then cd into themyfirstprojectdirectory and open up your editor. It should look something like this:myfirstproject/
  html/
  root/
    config.json
    index.py
  static/
    css/
      index.css
    images/
    js/
      index.js

  app.py
  config.jsonTheapp.pyfile should contain some boilerplate code. You can use theappobject just like a normal Flask object! App configurations should be done inside thewebpy_setupfunction. Route functions can still be created. Theconfig.jsonfile in the same directory as theapp.pyfile configures how WebPy will run your app. It takes any arguments that are valid to pass toapp.run().Underroot/, you can useindex.pyandindex.htmlfiles to create filesystem-based webpage routes. If you use anindex.pyfile, WebPy will call thehandlerfunction and pass the app as an argument. If you useindex.html, WebPy will just return that HTML file to the requester. Each filesystem route has aconfig.jsonfile. In this file, you can pass any keyword arguments that would be valid to pass toapp.route().Let's create a new page athttp://127.0.0.1:5000/hello. To do this, we can create a new folder calledhello/under theroot/folder. Cd into theroot/directory and typewebpy route hello. WebPy will automatically create thehello/directory for you.myfirstproject/root/
  hello/
    index.py
    config.json

  ...Since we only want this route to be a simple HTML page, we can deleteindex.pyand replace it with anindex.htmlfile.index.html<!DOCTYPE html><html><head><linkrel="stylesheet"href="/static/css/index.css"/></head><body><h1id="heading">Hello, World!</h1></body></html>Now, we can run our app usingwebpy run. Notice that when visitinghttp://127.0.0.1:5000/hello, the CSS that we linked from thestatic/folder is included.If you want to make your app a little more compact, you can usewebpy build. This will compile all of your Python and HTML into a single minifed file,build.py, which can be run like a normal Python script. However, the thehtml/andstatic/directories are not packaged into the build file, so these must still be present to runbuild.py. When usingwebpy runto run the app, changes in the files underroot/and changes in files understatic/are guaranteed to be reflected in the app without having to restart it, but if the app is being run from abuild.pyfile, changes in HTML, Python, and config files underroot/will not be reflected.PyXcan also be integrated into WebPy apps by changing Python files to.pyxfiles. These files can be compiled to Python files usingwebpy buildpyx, which is automatically run by thewebpy build,webpy compile, andwebpy runcommands. WebPy comes with PySite/PyX as a dependency. Note that one must still import PySite HTML tags in every file that PyX is used, as shown below:fromwebpy.pysite_semantic_tagsimport*# recommended### ORfrompysite.tagsimport*# also works, but doesn't filter out unnecessary classes such as Element