2 min read

Masonite, the popular Python web development framework, has released a new version. Masonite 2.0 comes with several new features to Masonite including new status codes, database seeding, built in cron scheduling, controller constructor resolving, speed improvements and much more.

A new ‘Tinker’ Command

Masonite 2.0 adds a new Tinker command that starts a Python shell and imports the container. It works as a great debugging tool and can be used for verifying that objects are loaded into the container correctly.

A new Task Scheduler

Masonite 2.0 adds a task scheduler,  a new default package that allows scheduling recurring tasks. You can read about the Masonite Scheduler under the Task Scheduling documentation.

Automatic Server Reloading

A huge update to Masonite is the new –reload flag on the serve command. Now the server will automatically restart when it detects a file change. You can use the -r flag as a shorthand.

Autoloading

With the new autoloading feature, you can list directories in the AUTOLOAD constant in the config/application.py file and it will automatically load all classes into the container. Autoloading is great for loading command and models into the container when the server starts up.

Database Seeding Support

Masonite 2.0 adds the ability to seed the database with dummy data. Seeding the database helps in populating the database with data that would be needed for future development.

Explicitly Imported Providers

Providers are now explicitly imported at the top of the file and added to the PROVIDERS list, located in config/providers.py. This completely removes the need for string providers and boosts the performance of the application substantially.

Status Code Provider

Masonite 2 removes the bland error codes such as 404 and 500 errors and replaces them with a cleaner view. It also allows adding of custom error pages.

Upgrading from Masonite 1.6 to Masonite 2.0

Masonite 1.6 to Masonite 2.0 has quite a large number of changes and updates in a single release. However, upgrading takes only around 30 mins for an average sized project. Read the Masonite upgrade guide for a step-by-step guide to upgrading.

You can read the release notes, for the full list of features.

Read Next

Python web development: Django vs Flask in 2018
What the Python Software Foundation & Jetbrains 2017 Python Developer Survey had to reveal
Should you move to Python 3? 7 Python experts’ opinions

Content Marketing Editor at Packt Hub. I blog about new and upcoming tech trends ranging from Data science, Web development, Programming, Cloud & Networking, IoT, Security and Game development.

LEAVE A REPLY

Please enter your comment!
Please enter your name here