Skipole WSGI generator.

Topics:

Introduction Getting Started Your Code skiadmin start_call submit_data end_call Exceptions PageData SectionData skicall Serving wsgi Code Examples

Development at GitHub:

github.com/bernie-skipole/skipole

skiadmin

Having created a project with:

python3 -m skipole myproj /path/to/my/projectfiles

Inspect the file /path/to/my/projectfiles/myproj.py, and you will see it contains the application:

    application = WSGIApplication(project='myproj',
                                  projectfiles=PROJECTFILES,
                                  proj_data={},
                                  start_call=start_call,
                                  submit_data=submit_data,
                                  end_call=end_call,
                                  url="/")

You will also see that a sub-project has been added:

if __name__ == "__main__":

    ############### THESE LINES ADD THE SKIADMIN SUB-PROJECT FOR DEVELOPMENT #
    ################# AND SHOULD BE REMOVED WHEN YOU DEPLOY YOUR APPLICATION #

    from skipole import skiadmin, set_debug, skilift
    set_debug(True)
    skiadmin_application = skiadmin.makeapp(editedprojname=PROJECT)
    application.add_project(skiadmin_application, url='/skiadmin')

    # serve the application with the development server from skilift

    host = "127.0.0.1"
    port = 8000
    print("Serving %s on port %s. Call http://localhost:%s/skiadmin to edit." % (PROJECT, port, port))
    skilift.development_server(host, port, application)

This code does three things, it calls set_debug(True), which gives enhanced error reporting, it creates a project 'skiadmin' which is added to your own project at url '/skiadmin', and it runs your application on a development web server.

Both your project, and the skiadmin sub project are served and can be accessed by your web browser. Skiadmin provides a web based method of adding pages and widgets to your web site.

Finally, when you deploy your code to a live web site, you would delete the above lines, so that the skiadmin sub project is no longer served.

skiadmin allows you to add pages of different types, and edit them, typically 'template' pages containing widgets, and 'responder' pages which accept incoming requests from the user, then calls your code, and passes the results to a template page, which is returned to the client.

The pages added by skiadmin are given 'idents' being (projectname, pagenumber) and labels mapping a name to these idents can be created. As well as 'pages', 'sections' can be created, which also contain widgets, and can be inserted into template pages, and 'textblocks' can be made which contain either plain text or your own html code.

When you create or alter any page, ensure you choose the 'Save' option to make your changes permanent, and also when you change your code you need to stop the site running (with ctrl-c), and start it again.