Web2py . Visual Studio Code . React . Typescript . Webpack

This is a web2py example application and Visual Studio Code setup that supports building and debugging a modern React style client interface using Typescript and Webpack while simultaneously being able to debug the python server in one environment. Please feel free to send me feedback if you think there are better ways to set things up. The web2py admin interface can also be used to edit the same files as Visual Studio Code when run locally.

Quickstart:

1. Install python3, node, npm, Visual Studio Code. Use Chrome as your browser.

2. Install python requests library (used by some of the contollers in this sample app)

3. Download a source archive of web2py and unzip it locally:

4. Copy the reactAndWeb2py folder inside the download you got from this github repo to the applications folder of your local copy of web2py

4.5 optionally set the default route to this application by changing routes.py to contain the line below:

5. Open the Visual Studio Code code-workspace file in VS Code:

6. Install the node modules needed for this project.

There are two ways to do this:

7. Launch the web2py server using the pre-configured VS Code launch task

8. Log in to the chrome window that has launched

9. You are already debugging the python server. If you want to debug the javascript as well:

10. You are up and running

Notes:

A number of web2py, and other, folders are set to be hidden for a clean experience. You can changed what's hidden by changing the exclude settings of the workspace in VS Code

Before packing up the web2py application to move to a server it would be wise to delete the node_modules folder (I don't know how to tell web2py not to pack everything)

For real deployment you would want to remove the static/reactsrc folder. It's needed for debugging as it contains the source and map files.