The modern and developer centric Python web framework that strives for an actual batteries included developer tool with a lot of out of the box functionality with an extremely extendable architecture. Masonite is perfect for beginner developers getting into their first web applications as well as experienced devs that need to utilize the full potential of Masonite to get their applications done.
Masonite works hard to be fast and easy from install to deployment so developers can go from concept to creation in as quick and efficiently as possible. Use it for your next SaaS! Try it once and you’ll fall in love.
NOTE: Masonite 2.3 is no longer compatible with the
masonite-cli tool. Please uninstall that by running
pip uninstall masonite-cli. If you do not uninstall
masonite-cli you will have command clashes
Easily send emails with the Mail Provider and the SMTP and Mailgun drivers.
Send websocket requests from your server with the Broadcast Provider and Pusher and Ably drivers.
IOC container and auto resolving dependency injection.
Service Providers to easily add functionality to the framework.
Extremely simple static files configured and ready to go.
Active Record style ORM called Orator.
An extremely useful command line tool called craft commands.
These, among many other features, are all shipped out of the box and ready to go. Use what you need when you need it.
In order to use Masonite, you’ll need:
Latest version of OpenSSL
If you are running on a Linux flavor, you’ll need the Python dev package and the libssl package. You can download these packages by running:
terminal$ sudo apt-get install python-dev libssl-dev python3-pip
Or you may need to specify your
terminal$ sudo apt-get install python3.6-dev libssl-dev python3-pip
terminal# dnf install python-devel openssl-devel
Masonite excels at being simple to install and get going. If you are coming from previous versions of Masonite, the order of some of the installation steps have changed a bit.
Firstly, open a terminal and head to a directory you want to create your application in. You might want to create it in a programming directory for example:
$ cd ~/programming$ mkdir myapp$ cd myapp
If you are on windows you can just create a directory and open the directory in the Powershell.
Although this step is technically optional, it is highly recommended. You can create a virtual environment if you don't want to install all of masonite's dependencies on your systems Python. If you use virtual environments then create your virtual environment by running:
terminal$ python -m venv venv$ source venv/bin/activate
or if you are on Windows:
terminal$ python -m venv venv$ ./venv/Scripts/activate
Now we can install Masonite. This will give us access to a craft command we can use to finish the install steps for us:
$ pip install masonite
Once Masonite installs you will now have access to the
craft command line tool. Craft will become your best friend during your development. You will learn to love it very quickly :).
You can ensure Masonite and craft installed correctly by running:
You should see a list of a few commands like
Great! We are now ready to create our first project. We should have the new
craft command. We can check this by running:
We are currently only interested in the
craft new command. To create a new project just run:
terminal$ craft new
This will also run
craft install which will install our dependencies.
This will get the latest Masonite project template and unzip it for you. We just need to go into our new project directory and install the dependencies in our
Now that Masonite installed fully we can check all the new commands we have available. There are many :).
We should see many more commands now.
After it’s done we can just run the server by using another
terminal$ craft serve
Congratulations! You’ve setup your first Masonite project! Keep going to learn more about how to use Masonite to build your applications.