At a minimum, the
jetfactory.Application needs to be created with at least one Jetpack.
Additional parameters can be provided to further customize the instance; see the docs below for more info.
Application(packages=None, path='/api', settings=None, **kwargs)¶
Creates a Jetfactory application
- packages – List of (<path>, <package>)
- path – Application root path
- settings – Settings overrides
- kwargs – kwargs to pass along to Sanic
run(host=None, port=None, workers=None, debug=False, sql_log=False, access_log=False, **kwargs)¶
Starts the HTTP server
- host – Listen host, defaults to 127.0.0.1
- port – Listen port, defaults to 8080
- workers – Number of workers, defaults to 1 per core.
- debug – Debugging
- sql_log – Log SQL-statements
- access_log – Log requests
- kwargs – Parameters to pass along to Sanic.run
Read more about this in the Configuration section.
import jetfactory import jet_apispec import jet_guestbook # Create application app = jetfactory.Application( path='/api', packages=[ ('/guestbook', jet_guestbook), ('/packages', jet_apispec) ] ) # Start server app.run(host='192.168.0.1')