You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ability to load plugins in non-web situations (#1)
Refactor plugin loading out of Application, to make it possible to load
plugins in non-web situations (scripts, cron jobs, etc.).
Document how to bootstrap Webware for command-line scripts.
Copy file name to clipboardExpand all lines: docs/appdev.rst
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -363,6 +363,25 @@ Now run this file in your IDE in debug mode. For instance, in PyCharm, right-cli
363
363
Some IDEs like PyCharm can also debug remote processes. This could be useful to debug a test or production server.
364
364
365
365
366
+
Bootstrap Webware from Command line
367
+
-----------------------------------
368
+
369
+
You may be in a situation where you want to execute some part of your Webware app from the command line, for example to implement a cron job or
370
+
maintenance script. In these situations you probably don't want to instantiate a full-fledged `Application` -- some of the downsides are that doing so
371
+
would cause standard output and standard error to be redirected to the log file, and that it sets up the session sweeper, task manager, etc.
372
+
But you may still need access to plugins such as MiscUtils, MiddleKit, which you may not be able to import directly.
373
+
374
+
Here is a lightweight approach which allows you to bootstrap Webware and plugins::
375
+
376
+
import webware
377
+
webware.add_to_python_path()
378
+
webware.load_plugins('/your/app/directory')
379
+
380
+
# now plugins are available...
381
+
import MiscUtils
382
+
import MiddleKit
383
+
384
+
366
385
How do I Develop an App?
367
386
------------------------
368
387
@@ -381,3 +400,5 @@ The answer to that question might not seem clear after being deluged with all th
381
400
* With this additional knowledge, create more sophisticated pages.
382
401
383
402
* If you need to secure your pages using a login screen, you'll want to look at the SecurePage, LoginPage, and SecureCountVisits examples in ``Examples``. You'll need to modify them to suit your particular needs.
0 commit comments