Modularize your masonite project.
pip install masonite-modulesAdd ModuleProvider to your project in config/providers.py:
# config/providers.py
# ...
from masonite_modules import ModuleProvider
# ...
PROVIDERS = [
# ...
# Third Party Providers
ModuleProvider,
# ...
]Publish the package resources by doing:
python craft package:publish modulesThe default modules location will be modules in the root directory of your project. But if you want your own custom name then, update the module name in config/modules.py to your desired module path name.
NAME=modulesOnce you finish publishing package, you need to install the modules by doing:
$ python craft module:installFinally, you will see the modules directory created in your project root.
To create the module, simply run:
$ python craft module:create <module_name>
# Example
$ python craft module:create blogThe above command will create a new module called blogs in the modules directory. It will also create all the necessary files and directories inside blogs so you can start working on your module.
Finally, visit /<module_name> i.e. /blogs then you will see a welcome message.
Enjoy!
masonite_modules is open-sourced software licensed under the MIT license.
