learn-py4web.github.io

Unit 1: Installing py4web, and editing code

In this unit, we learn how to install py4web, and how to edit its files via Visual Studio Code, which allows for easy editing and debugging. You can also enable GitHub Copilot, which understands py4web pretty well, by enabling the Copilot extension in VSCode.

Resources

Videos

Note: The installation video briefly mentions two minor bugs; these have been fixed already in py4web.

VSCode Configuration Files

On my linux system, I use the following files to configure VSCode for py4web development (replace /home/luca with your home directory). The files are in the root py4web directory.

launch.json

{
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Python: py4web",
            "type": "python",
            "request": "launch",
            "program": "py4web.py",
            "args": [
                "run", "--errorlog=:stdout", "-L", "20",
                "apps"
            ],
            "console": "integratedTerminal",
            "justMyCode": true
        },
        {
            "name": "Python: File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "justMyCode": true
        }
    ]
}