Skip to content

Bundling qbank

cjshawMIT edited this page Apr 28, 2017 · 9 revisions

Scenarios for bundling

If you need a standalone qbank executable (for running with unplatform, for example), then you can use pyinstaller to create a bundle. This should work with OS X, Windows, or Linux, whatever pyinstaller supports. Note that to create a bundle for a platform, you need to run pyinstaller on that specific platform. You cannot build Windows bundles on OS X.

The bundled package will run on port 8080 unless you manually change main.py and insert the port before bundling, like:

if (not is_test()) and __name__ == "__main__":
    sys.argv.append('9123')
    app.run()

This is because pyinstaller does not allow you to include command line arguments as part of the bundling process.

Pyinstaller

There are many hidden imports in qbank that need to be declared for pyinstaller to include them. The best way to create the bundle is using the included spec file.

pyinstaller main.spec