Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
DOCS: update watch option default
Browse files Browse the repository at this point in the history
  • Loading branch information
nicozanf committed Aug 13, 2021
1 parent afb8e35 commit f2fc1af
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 37 deletions.
32 changes: 16 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,20 @@ Launch Arguments
Options:
-Y, --yes No prompt, assume yes to questions [default:
False]
False]
-H, --host TEXT Host name [default: 127.0.0.1]
-P, --port INTEGER Port number [default: 8000]
-p, --password_file TEXT File for the encrypted password [default:
password.txt]
-s, --server [default|wsgiref|tornado|gunicorn|gevent|waitress|
-s, --server [default|wsgiref|tornado|gunicorn|gevent|waitress|
geventWebSocketServer|wsgirefThreadingServer|rocketServer]
server to use [default: default]
-w, --number_workers INTEGER Number of workers [default: 0]
-d, --dashboard_mode TEXT Dashboard mode: demo, readonly, full
(default), none [default: full]
-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 (default), sync,
lazy
automatically, modes: off, sync, lazy
[default: lazy]
--ssl_cert PATH SSL certificate file for HTTPS
--ssl_key PATH SSL key file for HTTPS
-help, -h, --help Show this message and exit.
Expand All @@ -127,25 +124,28 @@ Tell me more
############

- it is 10-20x faster than web2py
- this is a work in progress and not stable yet but close to being stable
- python3.6+ 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 https://github.com/web2py/pydal (same DAL as web2py) for database connection
- uses the same validators as web2py (they are in pyDAL)
- uses the very similar helpers to web2py (A, DIV, SPAN, etc.)
- uses `yatl <https://pypi.org/project/yatl/>`__ (same as web2py but defaults to [[...]] instead of {{...}} delimiters) and `Renoir <https://pypi.org/project/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
- 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 <https://dbader.org/blog/python-memoization>`__
- supports multiple apps under apps folder (same as web2py)
- unlike web2py does not use a custom importer or eval
- 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
- SQLFORM has been replaced by py4web/utils/form.py
- it comes with a Grid object providing simple grid and CRUD capabilities
- it comes with a Form object (like SQLFORM on web2py)
- it comes with a Grid object providing grid and CRUD capabilities
- it supports `htmx <https://htmx.org/>`__


- this is a work in progress and not stable yet but close to being stable
- there are not enough tests


Expand Down
16 changes: 13 additions & 3 deletions docs/chapter-02.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ We also use to chat sometime on IRC (Internet Relay Chat, which is an old-style
From time to time we also use it to host a scheduled public chat, where you can write and read live questions to developers.
Transcripts of them are then available on the mailing list.

The Discord server
-------------------

For quick questions and chats you can also use the free `Discord server dedicated to py4web <https://discord.gg/xCzQ9KTk3W>`__. You could usually find many py4web developers hanging out in the channel.


Tutorials and video
-------------------
Expand All @@ -37,7 +42,8 @@ There are many tutorials and videos available. Here are some of them:
- the `Learn Py4Web site <https://learn-py4web.github.io>`__ by Luca de Alfaro (with lots of excellent training videos)
- the free video `course 2020 by Luca de Alfaro <https://sites.google.com/a/ucsc.edu/luca/classes/cmps-183-hypermedia-and-the-web/cse-183-spring-2020>`__ at UC Santa Cruz
- the `py4web blog app <https://github.com/agavgavi/py4web-blog-app.git>`__ by Andrew Gavgavian, which uses py4web to replicate the famous Corey Schafer's tutorial series on creating a blog app in Django

- the `South Breeze Enterprises demo app <https://github.com/jpsteil/southbreeze>`__ by `Jim Steil <https://github.com/jpsteil>`__. It is built around the structure of the Microsoft Northwind database,
but converted to SQLite. You can view the final result online `here <https://southbreeze.pythonbench.com>`__

The sources on GitHub
---------------------
Expand Down Expand Up @@ -82,8 +88,12 @@ we also suggest to:
Debugging py4web with VScode
----------------------------

In order to run py4web.py within VScode, you need to add ``"args": ["run", "apps"]`` to the vscode ``launch.json``
configuration file. In addition, if you should get gevent errors you have to add ``"gevent": true`` on the same configuration file.
It's quite simple to run and debug py4web within VScode. You just need to open the main py4web folder (not the apps folder!) and add:

- ``"args": ["run", "apps"],``
- ``"program": "your_full_path_to_py4web.py",``

to the vscode ``launch.json`` configuration file. In addition, if you should get gevent errors you have to also add ``"gevent": true`` on the same configuration file.

Debugging py4web with PyCharm
-----------------------------
Expand Down
14 changes: 7 additions & 7 deletions docs/chapter-03.rst
Original file line number Diff line number Diff line change
Expand Up @@ -366,22 +366,22 @@ This currently gives an error on binaries installations and from source installa

--watch [off|sync|lazy] Watch python changes and reload apps
automatically, modes: off, sync, lazy
[default: off]
[default: lazy]

--ssl_cert PATH SSL certificate file for HTTPS
--ssl_key PATH SSL key file for HTTPS
-help, -h, --help Show this message and exit.

If you want py4web to automatically reload an application upon any
changes to files of that application, you can:

- for immediate reloading (sync-mode): ``py4web run --watch=sync``
By default py4web will automatically reload an application upon any changes to the python files of that application.
The reloading will occur on any first incoming request to the application that has
been changed (lazy-mode). If you prefer an immediate reloading (sync-mode), use
``py4web run --watch=sync``. For production servers, it's better to use ``py4web run --watch=off`` in order
to avoid unneded checks (but you will need to restart py4web for activating any change).

- for reloading on any first incoming request to the application has
been changed (lazy-mode): ``py4web run --watch=lazy``

.. note::
The optional ``--watch`` directive looks for any changes occurring to the python files under the
The ``--watch`` directive looks for any changes occurring to the python files under the
``/apps`` folder only. Any modifications to the standard py4web programs will always require a full
restart of the framework.

Expand Down
9 changes: 6 additions & 3 deletions docs/chapter-09.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
YATL Template Language
======================

py4web, by default, uses a template language called **YATL** (Yet Another Template Language) for rendering dynamic HTML pages that contain Python code.
py4web uses two distinct template languages for rendering dynamic HTML pages that contain Python code:

There are two Python modules that implement a renderer from YAML to HTML. One is `yatl <https://pypi.org/project/yatl/>`__ and one is `Renoire <https://pypi.org/project/renoir/>`__. The two implementations should be equivalent but the former is considered the original reference implementation. The latter is a newer and faster implementation with additional fuctionality. ``yatl`` also comes with HTML helpers (see next chapter) which are not included in ``renoir``.
- `yatl (Yet Another Template Language) <https://pypi.org/project/yatl/>`__ , which is considered the original reference implementation
- `Renoir <https://pypi.org/project/renoir/>`__, which is a newer and faster implementation of yatl with additional functionality

py4web uses the ``yatl`` module for helpers and the ``renoir`` module for rendering templates, and some minor trickery to make them work together seamlessly.

Since ``Renoir`` does not include HTML helpers (see next chapter), py4web by default uses the ``Renoir`` module for rendering templates and the ``yatl`` module for helpers,
plus some minor trickery to make them work together seamlessly.

py4web also uses double square brackets ``[[ ... ]]`` to escape Python code embedded in HTML, unless specified otherwise.

Expand Down
8 changes: 4 additions & 4 deletions docs/chapter-12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ in line 16,17 we declare two endpoints :
- ``form_basic/index`` (a create form)
- ``form_basic/index/{id}`` (an edit form for the specified record id)

Because this is a dual purpuse form, in case an ``id`` is passed, we also valdate it
by checking the corrsponding record exists and raie 404 if not.
Because this is a dual purpose form, in case an ``id`` is passed, we also validate it
by checking if the corresponding record exists and raise 404 if not.

To use it we will need a template ``templates/form_basic.html`` that
contains, for example, the following code:
Expand Down Expand Up @@ -225,7 +225,7 @@ Here is a simple example of how to require a validator for a table field:
)
The validator is frequently
written explicitly outside the table definition in this equivalent sytntax:
written explicitly outside the table definition in this equivalent syntax:
.. code:: python
Expand Down Expand Up @@ -283,7 +283,7 @@ Here is an example of a validator on a database table:
where we have used the translation operator ``T`` to allow for internationalization.
Notice that error messages are not translated by default unless you define them explicitely with ``T``.
Notice that error messages are not translated by default unless you define them explicitly with ``T``.
One can also call validators explicitly for a field:
Expand Down
2 changes: 1 addition & 1 deletion docs/chapter-14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ auto-generated CRUD pages and handle the detail pages yourself.
Custom Columns
--------------

If the grid does not involve a join but displayes results from a single table
If the grid does not involve a join but displays results from a single table
you can specify a list of columns and columns are highly customizable.

.. code:: python
Expand Down
6 changes: 3 additions & 3 deletions docs/chapter-15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ The latter requires ``utils.js`` from the scaffolding app to render
the custom tag into a div with dismissal behavior.

Also notice that ``Flash`` is special: it is a singleton.
So if you instantiate mutlple Flash objects they share their data.
So if you instantiate multiple Flash objects they share their data.

“grid” example
~~~~~~~~~~~~~~
Expand Down Expand Up @@ -376,7 +376,7 @@ Notice that in web2py ``auth.user`` is the current logged-in user
retrieved from session. In py4web instead ``auth.user`` is a fixture which serves the
same purpose as ``@requires_login`` in web2py. In py4web only the ``user_id``
is stored in the session and it can be retrieved using ``auth.user_id``.
If you need more information about the user, you need to fecth the record
If you need more information about the user, you need to fetch the record
from the database with ``auth.get_user()`` The latter returns all readable
fields as a Python dictionary.

Expand All @@ -394,7 +394,7 @@ and
In the first case the decorated action can access the auth object
but ``auth.user_id`` may be None if the user is not logged in. In the second
case we are requiring a valliid logged in user and therefore ``auth.user_id``
case we are requiring a valid logged in user and therefore ``auth.user_id``
is guaranteed to be a valid user id.

Also notice that if an action uses auth, then it automatically uses
Expand Down
4 changes: 4 additions & 0 deletions docs/spelling_wordlist_en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ kbytes
kinterbasdb
kwargs
lastdot
lib
libs
limitby
localhost
lookups
Expand All @@ -124,6 +126,7 @@ mysql
MySQLdb
natively
ndb
Northwind
NoSQL
OAuth
ondelete
Expand Down Expand Up @@ -205,6 +208,7 @@ txt
ual
un
unicode
unneded
uri
url
urls
Expand Down

0 comments on commit f2fc1af

Please sign in to comment.