Gramex 1.70 introduces support for MongoDB, Bootstrap 5, VueJS, minimal scaffolding, and more.
FormHandler now supports MongoDB as a data source.
To use it, create a FormHandler with this configuration:
url:
mongodb-data:
pattern: /data
handler: FileHandler
kwargs:
url: plugin:mongodb://localhost:27017
database: database-name
collection: collection-name
The contents of the collection can be queried via the /data
URL. You can also use
FormHandler query feature to construct complex queries.
Bootstrap 5 is released, and Gramex is ready. You can use floating labels, offcanvas, custom switches and more.
The full list of UI Components is available for Bootstrap 5. So, instead of adding the default Bootstrap 4 theme to your HTML:
<link rel="stylesheet" href="ui/theme/default.scss" />
… add the Bootstrap 5 theme instead:
<link rel="stylesheet" href="ui/theme/bootstrap5.scss" />
That’s it. All Bootstrap 5 styles are available.
FileHandler can compile Vue single-file components.
The default FileHandler compiles any .vue
file into CSS. For example, this hello-world.vue
file:
<template>
<p>{{ greeting }} World!</p>
</template>
<script>
module.exports = {
data: function () {
return {
greeting: "Hello",
};
},
};
</script>
<style scoped>
p {
font-size: 2em;
text-align: center;
}
</style>
(function(t){var e={};function n(r){if(e[r]) /* JS contents trimmed */
To enable this in your FileHandler, add:
kwargs:
...
vue: '*.vue' # Compile .vue files into JS
To install the minimal files required to run Gramex, run gramex init minimal
(instead of gramex init
) on your terminal.
It initializes a git
repository and creates these files:
gramex.yaml
: Gramex configurationindex.html
: default home pagetable
parameterapproval_prompt
parameter is removed{{ appname }}
in README.md into the actual app nameThe Gramex code base has:
See the Gramex installation and upgrade instructions.
Note: Gramex 1.70 does not work with Python 3.8 or 3.9. We recommend Python 3.7.