Skip to content
No description, website, or topics provided.
JavaScript Python CSS HTML Objective-C++ Shell Other
Branch: master
Clone or download

Latest commit

mdipierro Merge pull request #217 from valq7711/patch-3
documentation index.html micro fix (http -> https)
Latest commit bb81df4 Jun 1, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
apps Merge pull request #217 from valq7711/patch-3 Jun 1, 2020
deployment_tools version 1.20200502.3 May 2, 2020
py4web fix modules clear up when reload May 27, 2020
tests auth injects user to template but not to ajax responses May 7, 2020
.gitignore One more fix Apr 6, 2020
.travis.yml travis moving to bionic May 18, 2020
CONTRIBUTORS.md Create CONTRIBUTORS.md May 22, 2020
Makefile add some header security checks May 4, 2020
README.md fix `set-password` May 20, 2020
py4web.py version 1.20200502.2 May 2, 2020
requirements.txt vesion 20200524.3 May 26, 2020
setup.py vesion 20200524.3 May 26, 2020
test-requirements.txt requre newer mechanize to avoid warnings in py3.8 Dec 28, 2019

README.md

py4web

Build Status

Try me (from pip)

python3 -m pip install -U py4web --no-cache-dir --user
py4web setup apps
py4web set-password
py4web run apps
open http://localhost:8000/todo/index

(The apps folder will be created with some apps inside)

Try me (from source)

git clone https://github.com/web2py/py4web.git
cd py4web 
python3 -m pip install -r requirements.txt
./py4web.py setup apps
./py4web.py set-password
./py4web.py run apps
open http://localhost:8000/todo/index

Try me (install from source)

git clone https://github.com/web2py/py4web.git
cd py4web
make assets
make test
make install
py4web run apps
open http://localhost:8000/todo/index

Notice "py4web" uses the pip installed py4web, "./py4web.py" uses the local one. Do not get confused. Also notice when installing from source the content of py4web/assets is missing and it is created by make assets.

Tell me more

  • this is a work in progress and not stable yet but close to being stable
  • python3 only
  • uses https://github.com/web2py/pydal (same DAL as web2py)
  • uses https://github.com/web2py/yatl (same as web2py but defaults to [[...]] instead of {{...}} delimiters)
  • uses the same validators as web2py (they are in pyDAL)
  • uses the very similar 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
  • 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
  • admin has been replaced by a _dashboard (90% done)
  • appadmin has been replaced by dbadmin (within dashboard) (90% done)
  • auth logic is implemented via a "auth" vue.js custom component (90% done)
  • SQLFORM has been replaced by py4web/utils/form.py
  • SQLFORM.grid was been replaced by a "mtable" vue.js custom component (90% done)
  • there are not enough tests
  • it is not as stable as web2py yet
  • it is 10-20x faster than web2py

Components

  • pydal + dbapi (done)
  • yatl (done)
  • pluralize (done)
  • auth (WIP, 90%)
  • mailer (done)
  • session (cookies, db, redis, memcache)
  • form (done up to downloads)
  • mtable (WIP, 75%)
  • dashboard (90% done)
  • scaffold (done)
  • bus (0%)
  • tornado (done)
  • gevent (done)
  • gunicorn (done)
  • bottle (done)

Storing _dashboard password

When py4web starts it asks for a _dashboard password and stores its pdkdf2 hash in password.txt, in the working folder. It will not ask again unless the file is deleted. If the --dashboard_mode is demo or none it will not ask. If you want to store it somewhere else, you can specify a name with --password_file.

You can create the file yourself with:

$ python3 -c "from pydal.validators import CRYPT; open('password.txt','w').write(str(CRYPT()(input('password:'))[0]))"
password: *****

Launch Arguments

usage: py4web-start.py [-h] [--host HOSTNAME] [--port PORT] [--headless] [-n NUMBER_WORKERS]
                       [--ssl_cert_filename SSL_CERT_FILENAME]
                       [--ssl_key_filename SSL_KEY_FILENAME]
                       [--service_db_uri SERVICE_DB_URI] [-d DASHBOARD_MODE]
                       [-p PASSWORD_FILE] [-c]
                       apps_folder

positional arguments:
  apps_folder           path to the applications folder

optional arguments:
  -h, --help            show this help message and exit
  --host HOSTNAME       server address (IP or hostname)
  --port PORT           server port number (e.g., 8000)
  --headless            hide artwork for console based servers
  -n NUMBER_WORKERS, --number_workers NUMBER_WORKERS
                        number of gunicorn workers
  --ssl_cert_filename SSL_CERT_FILENAME
                        ssl certificate file
  --ssl_key_filename SSL_KEY_FILENAME
                        ssl key file
  --service_db_uri SERVICE_DB_URI
                        db uri for logging
  -d DASHBOARD_MODE, --dashboard_mode DASHBOARD_MODE
                        dashboard mode: demo, readonly, full (default), none
  -p PASSWORD_FILE, --password_file PASSWORD_FILE
                        file containing the encrypted (CRYPT) password
  -c, --create          created the missing folder and apps

Example:

py4web-start -a 127.0.0.1:8000 -d demo apps

WSGI

py4web is a WSGI application. To obtain the WSGI app simply do:

from py4web.core import wsgi
application = wsgi()

The wsgi function takes arguments with the same name as the command line arguments.

Contributors

Screenshots

You can’t perform that action at this time.