Skip to content

Commit 4797858

Browse files
Update README
New skeleton files added.
1 parent e3828d0 commit 4797858

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
* [htmltree](https://github.com/Michael-F-Ellis/htmltree) >= 0.7.5
2828
* pip install htmltree
2929

30-
### NEW Single Source File
31-
Use the recently added `allinone.py` which combines the content of 3 files into a single one that automatically builds the Javascript and launches the server. Just do `python allinone.py` instead of `python server.py`. Note that `allinone.py` will likely be the focus of future development and, hence, will continue to diverge from the behavior of `server.py + client.py + common.py`.
30+
### NEW Single Source Files
31+
Use the recently added `allinone.py` which combines the content of 3 files into a single one that automatically builds the Javascript and launches the server. Just do `python allinone.py` instead of `python server.py`. There are also two other new files, `minimal_allinone.py` and `serverless.py`. These files will likely be the focus of future development and, hence, will continue to diverge from the behavior of `server.py + client.py + common.py` which should now be considered deprecated, or at least discouraged.
3232

3333
### Installation and usage
3434
```
@@ -49,7 +49,7 @@ Use the recently added `allinone.py` which combines the content of 3 files into
4949
![Figure 1.](doc/img/nppwad2.gif)
5050

5151
### Rapid development
52-
* Saving a change to any source file triggers a rebuild and reload of the server and the client page. See [Auto Reload](doc/AutoReload.md) for details.
52+
* While the app is running, saving a change to any source file triggers a rebuild and reload of the server and the client page. See [Auto Reload](doc/AutoReload.md) for details.
5353
* Clean pythonic syntax for generating html. See [htmltree](https://github.com/Michael-F-Ellis/htmltree) docs for details. Here's the function that creates all the body html in the demo above.
5454
```
5555
def makeBody():
@@ -183,6 +183,20 @@ and here is the output `makeBody()` produces:
183183
</div>
184184
</div>
185185
```
186+
### Starting Smaller
187+
If `allinone.py` is a least somewhat close to where you want to start with development, you can simply make a copy under a new names and start hacking, but you might find a better starting point for your development in one of the two additional skeleton files provided in the repo.
188+
189+
## minimal_allinone.py
190+
This skeleton omits most of the content from allinone.py but retains the server instance, command line options and automatic reloading. The client-server state exchange is also kept but in very minimal form. The display is simply a headline with a counter updating once per second with a count supplied from the server.
191+
192+
![Figure 2.](doc/img/minimal.gif)
193+
194+
195+
## serverless.py
196+
As the name implies, this skeleton has the server code removed. It's a once-through script that generates an index.html file and and a js file with Transcrypt. The script finishes by using Python's built-in web browser module to open the index file as a `file://` URL in your default web browser. When the index file loads it fetches and runs the JS. The display is identical in form to the one from `minimal_allinone.py` but the counter updating is handled locally in JS.
197+
198+
![Figure 3.](doc/img/serverless.gif)
199+
186200
### Files
187201
Here's what comes from the repository:
188202
```
@@ -196,7 +210,9 @@ Here's what comes from the repository:
196210
│   ├── example_wsgi.py
197211
│   └── img
198212
│   └── nppwad.gif
213+
├── minimal_allinone.py.py
199214
├── server.py (deprecated)
215+
├── serverless.py
200216
201217
```
202218
Ater running `allinone.py` for the first time, files are generated and the directory tree will look like:
@@ -221,16 +237,18 @@ Ater running `allinone.py` for the first time, files are generated and the direc
221237
│   ├── example_wsgi.py
222238
│   └── img
223239
│   └── nppwad.gif
240+
├── minimal_allinone.py.py
224241
├── server.py
242+
├── serverless.py
225243
226244
```
227245

228246
## Parting Thoughts
229247
### The Bad News
230-
While this approach can save you from the frustrations of dealing with .html, .css, and .js syntax, it can't save you from the need to *understand* the Document Object Model, browser events, ajax, http request routing, etc.
248+
While this approach to development can save you from the frustrations of dealing with .html, .css, and .js syntax, it can't save you from the need to *understand* the Document Object Model, browser events, ajax, http request routing, etc.
231249

232250
### The Good News
233-
If you're already comfortable in Python and understand what goes on in a browser and web server, you can use this skeleton as a starting point for developing entirely in Python.
251+
If you're already comfortable in Python and understand what goes on in a browser and web server, you can use these skeletons as a starting point for developing entirely in Python.
234252
<hr>
235253
Footnotes
236254

0 commit comments

Comments
 (0)