Skip to main content

A fast, stable, comprehensive web framework

Project description

https://img.shields.io/pypi/v/py4web.svg

PY4WEB is a web framework for rapid development of efficient database driven web applications. It is an evolution of the popular web2py framework but much faster and slicker.

Screenshots

Running py4web

https://py4web.com/_documentation/static/en/_images/first_run.png

The main Dashboard

https://py4web.com/_documentation/static/en/_images/dashboard_main.png

Editing a file in the Dashboard

https://py4web.com/_documentation/static/en/_images/dashboard_edit.png

Editing a database in the Dashboard

https://py4web.com/_documentation/static/en/_images/dashboard_restapi.png

Installation

PY4WEB runs fine on Windows, MacOS and Linux. There are many installation procedures (see the official documentation for details) but only two of them are summarized here.

The simplest way to install py4web is using binaries, but it’s only available for Windows and MacOS. It’s meant especially for newbies or students, because it does not require Python pre-installed on your system nor administrative rights. You just need to download the latest Windows or MacOS ZIP file from this external repository. Unzip it on a local folder and open a command line there. Finally run the commands (omit ‘./’ if you’re using Windows)

./py4web set_password
./py4web run apps

The standard installation procedure for py4web on Windows, MacOS and Linux is using pip. Its only prerequisite is Python 3.7+.

python3 -m pip install --upgrade py4web --no-cache-dir --user

but do not type the ‘’–user’’ option with virtualenv or a standard Windows installation which is already per-user. Also, if ‘’python3’’ does not work, try with the simple ‘’python’’ command instead.

This will install the latest stable release of py4web and all its dependencies on the system’s path only. After the installation you’ll be able to start py4web on any given working folder with

py4web setup apps
py4web set_password
py4web run apps

Launch Arguments

 # py4web run -h

 Usage: py4web.py run [OPTIONS] APPS_FOLDER

    Run all the applications on apps_folder

 Options:
-Y, --yes                       No prompt, assume yes to questions
-H, --host TEXT                 Host listening IP  [default: 127.0.0.1]
-P, --port INTEGER              Port number  [default: 8000]
-A, --app_names TEXT            List of apps to run, comma separated (all if
                                omitted or empty)
-p, --password_file TEXT        File for the encrypted password  [default:
                                password.txt]
-Q, --quiet                     Suppress server output
-R, --routes                    Write apps routes to file
-s, --server [default|wsgiref|tornado|gunicorn|gevent|waitress|gunicorn|gunicornGevent|
                                gevent|geventWebSocketServer|geventWs|
                                wsgirefThreadingServer|wsgiTh|rocketServer]
                                Web server to use
-w, --number_workers INTEGER    Number of workers  [default: 0]
-d, --dashboard_mode TEXT       Dashboard mode: demo, readonly, full, none
                                [default: full]
--watch [off|sync|lazy]         Watch python changes and reload apps
                                automatically, modes: off, sync, lazy
                                [default: lazy]
--ssl_cert PATH                 SSL certificate file for HTTPS
--ssl_key PATH                  SSL key file for HTTPS
--errorlog TEXT                 Where to send error logs
                                (:stdout|:stderr|tickets_only|{filename})
                                [default: :stderr]
-L, --logging_level INTEGER     The log level (0 - 50) [default: 30
                                (=WARNING)]
-D, --debug                     Debug switch
-U, --url_prefix TEXT           Prefix to add to all URLs in and out
-m, --mode TEXT                 default or development  [default: default]
-h, -help, --help               Show this message and exit.

Example:

py4web run -H 127.0.0.1 -P 8000 -d demo apps

Note that since the default (as specified above) for the host and port are 127.0.0.1 and 8000 respectively, the above command can be shortened to:

py4web run -d demo apps

Tell me more

  • it is 10-20x faster than web2py

  • python3.7+ only

  • uses https://github.com/web2py/pydal (same DAL as web2py) for database connection

  • uses the same validators as web2py (they are in pyDAL)

  • uses yatl (same as web2py but defaults to [[…]] instead of {{…}} delimiters) and Renoir for html templates

  • uses the very similar html helpers to web2py (A, DIV, SPAN, etc.)

  • uses https://github.com/web2py/pluralize for i18n and pluralization

  • request, response, abort are from https://bottlepy.org, using ombott (One More BOTTle), which is a fast bottlepy spin-off

  • HTTP and redirect are our own objects

  • like web2py, it supports static asset management /{appname}/static/_0.0.0/{path}

  • implements sessions in cookies (jwt encrypted), db, memcache, redis and custom

  • implements a cache.memoize (Ram cache with O(1) access) Memoize

  • supports multiple apps under apps folder (same as web2py)

  • unlike web2py does not use a custom importer or eval (this allow simple debugging with standard IDE)

  • admin has been replaced by a _dashboard

  • appadmin has been replaced by dbadmin (within _dashboard)

  • auth logic is implemented via a “auth” vue.js custom component

  • it comes with a Form object (like SQLFORM on web2py)

  • it comes with a Grid object providing grid and CRUD capabilities

  • it supports htmx

  • this is a work in progress and not stable yet but close to being stable

  • there are not enough tests

Contributors

Special thanks to Sam de Alfaro, that designed the official logo of py4web. We friendly call the logo “Axel the axolotl”: it magically represents the sense of kindness and inclusion we believe it’s the cornerstone of our growing community.

docs/images/logo.png

Many thanks to everyone who has contributed to the project, and especially:

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py4web-1.20241019.1.tar.gz (9.2 MB view details)

Uploaded Source

Built Distribution

py4web-1.20241019.1-py3-none-any.whl (9.2 MB view details)

Uploaded Python 3

File details

Details for the file py4web-1.20241019.1.tar.gz.

File metadata

  • Download URL: py4web-1.20241019.1.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for py4web-1.20241019.1.tar.gz
Algorithm Hash digest
SHA256 1f9e717ae57c2c73ff1d200d70f7d8fbd96f6e46219d60618de905c283c11cc4
MD5 8a81388031664955498aaad4ee4687d8
BLAKE2b-256 73a57aa17f9ddf04d752fa8d14c2792fc8d15d35df57c93dbbb96f07756b52a0

See more details on using hashes here.

File details

Details for the file py4web-1.20241019.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py4web-1.20241019.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7162149efb4a45c9374b1f4e6c4fa49410ec3a524a9238e122a0978050cb537
MD5 fcaf995c03c2f5c91335adc5069534c3
BLAKE2b-256 6cdc62a1a1bcfa5fc7ae1a97074509b3b8bc9ec939ce8a65db46fa46646796f2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page