Skip to content
The Modern And Developer Centric Python Web Framework. Be sure to read the documentation and join the Slack channel questions:
Branch: 2.2
Clone or download
Latest commit ae7256f Oct 11, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
app removed unused import Jun 15, 2019
bootstrap Add D400: First line should end with a period Nov 9, 2018
config Update Aug 15, 2019
databases fix pep8 Jun 11, 2019
resources fix pep8 Jun 11, 2019
routes better route May 24, 2019
storage fix pep8 Jun 11, 2019
tests fix pep8 Jun 11, 2019
.env-example Merge branch 'develop' into 2.2 Jun 15, 2019
.env.testing added default .env.testing file Jun 15, 2019
.gitignore added default .env.testing file Jun 15, 2019
.travis.yml adjust travis CI Aug 5, 2019
LICENSE Update LICENSE Jan 4, 2019 Update Oct 10, 2019
craft Merge pull request #154 from carc1n0gen/master Sep 19, 2019
requirements.txt bumped versioon Jun 15, 2019 added init to config directory Nov 28, 2018

Python Version License License License

NOTE: This repository is the general shell of the framework. This repository is responsible for managing the installation of all new applications. All core framework related code has been abstracted out into it's own PYPI package which can be found in this GitHub Repo.

About Masonite

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.

  • Having a simple and expressive routing engine
  • Extremely powerful command line helpers called craft commands
  • A simple migration system, removing the "magic" and finger crossing of migrations
  • A great Active Record style ORM called Orator
  • A great filesystem architecture for navigating and expanding your project
  • An extremely powerful Service Container (IOC Container)
  • Service Providers which makes Masonite extremely extendable

Learning Masonite

Masonite strives to have extremely comprehensive documentation. All documentation can be Found Here and would be wise to go through the tutorials there. If you find any discrepencies or anything that doesn't make sense, be sure to comment directly on the documentation to start a discussion!

If you are a visual learner you can find tutorials here: MasoniteCasts

Also be sure to join the Slack channel!


  • Python 3.4 +
  • OpenSSL (latest version)
  • Pip


If you are running on a Linux flavor, you’ll need a few extra packages before you start. You can download these packages by running:

$ sudo apt-get install python-dev libssl-dev

Instead of python-dev you may need to specify your Python version

$ sudo apt-get install python3.6-dev libssl-dev


With windows you will need to have the latest OpenSSL version. Install OpenSSL 32-bit or 64-bit.


If you do not have the latest version of OpenSSL you will encounter some installation issues with creating new applications since we need to download a zip of the application via GitHub.

With Mac you can install OpenSSL through brew.

brew install openssl

Python 3.6 does not come preinstalled with certificates so you may need to install certificates with this command:

/Applications/Python\ 3.6/Install\ Certificates.command

You should now be good to install new Masonite application of Mac :)

Python 3.7

If you are using Python 3.7, add it to your PATH Environment variable.

Open Windows PowerShell and run: pip install masonite-cli

Add C:\Users\%USERNAME%\.AppData\Programs\Python\Python37\Scripts\ to PATH Environment variable.

Note: PATH variables depend on your installation folder


    $ pip3 install masonite-cli :: (may need sudo if using UNIX) ::
    $ craft new project
    $ cd project
    $ craft install
    $ craft serve

Go to http://localhost:8000/

* * * *

Not all computers are made the same so you may have some trouble installing Masonite depending on your machine. If you have any issues be sure to read the Known Installation Issues Documentation.

* * * *


Please read the Contributing Documentation here. Development will be on the current releasing branch of the Core Repository (typically the develop branch) so check open issues, the current Milestone and the releases in that repository. Ask any questions you like in the issues so we can have an open discussion about the framework, design decisions and future of the project.


Thank you for those who have contributed to Masonite!

Vaibhav Mule

Martín Peveri


Abram C. Isola

Raphael Schubert

Mitch Dennett


The Masonite framework is open-sourced software licensed under the MIT license.

Hello World

Getting started is very easy. Below is how you can get a simple Hello World application up and running.


The best way to install Masonite is by starting in a virtual environment first. This will avoid any issues with filesystem permissions.

python3 -m venv venv

Then activate the virtual environment:

WINDOWS: $ ./venv/Scripts/activate
MAC: $ source venv/bin/activate

You can easily create new applications with craft. To create a new application run:

$ pip install masonite-cli
$ craft new project .

The . will tell craft to create the project in the current directory instead of a new directory.

$ craft install

This will install all of Masonites dependencies as well as create a new .env file consisting of all of your environment variables.

* * * *

NOTE: Python craft commands are essentially wrappers around common mundane tasks. Read the docs about the craft command tool to learn more

* * * *

Now we can run the craft command:

$ craft serve

This will run the server at localhost:8000 and be in an auto-reloading state. When you change files, your server will restart. Navigating to that URL should show the Masonite welcome message.

If that port is blocked you can specify a port by running:

$ craft serve --port 8080

Or specify a host by running:

$ craft serve --host

Hello World

All web routes are in routes/ In this file is already the route to the welcome controller. To start your hello world example just add something like:

Get('/hello/world', 'HelloWorldController@show'),

our routes constant file should now look something like:

    Get('/', 'WelcomeController@show'),
    Get('/hello/world', 'HelloWorldController@show'),

* * * *

NOTE: Notice this new interesting string syntax in our route. This will grant our route access to a controller (which we will create below)

* * * *

Since we used a string controller we don't have to import our controller into this file. All imports are done through Masonite on the backend.

You'll notice that we have a reference to the HelloWorldController class which we do not have yet. This framework uses controllers in order to separate the application logic. Controllers can be looked at as the in a Django application. The architectural standard here is 1 controller per file.

In order to make the HelloWorldController we can use a craft command:

$ craft controller HelloWorld

This will scaffold the controller for you and put it in app/http/controllers/ This new file will have all the imports for us.

Inside the HelloWorldController we can make our show method like this:

def show(self, view: View):
    """ Show Hello World Template """
    return view.render('helloworld')

As you see above, we are returning a helloworld template but we do not have that yet. All templates are in resources/templates. We can simply make a file called helloworld.html or run the craft command:

$ craft view helloworld

Which will create the resources/templates/helloworld.html template for us.

Lastly all templates run through the Jinja2 rendering engine so we can use any Jinja2 code inside our template like:

inside the resources/views/helloworld.html

{{ 'Hello World' }}

Now just run the server:

$ craft serve

And navigate to localhost:8000/hello/world and you will see Hello World in your browser.

Happy Crafting!

You can’t perform that action at this time.