DEV Community

Dilan Tsasi
Dilan Tsasi

Posted on

How to install Masonite On Windows

The Masonite Framework is a modern and developer-centric Python web framework. This framework works hard to be fast and easy from installation to deployment so developers can go from concept to creation as quickly and efficiently as possible.

In this tutorial, I will show you how to install masonite 3.0 and set up a masonite project on a Windows computer
This tutorial assumes that you understand the basics of python and pip commands

Requirements

  1. Python 3.6+
  2. The latest version of OpenSSL
  3. Pip3

How to install masonite

The first thing to do is to open your command prompt and navigate to the directory where you want to get it installed.

cd c:\my\masonite\directory
Enter fullscreen mode Exit fullscreen mode

Once in this folder, create a new folder for your masonite project. and change directory to it

mkdir my_app
cd my_app
Enter fullscreen mode Exit fullscreen mode

One optional step you can go through is activating your virtual environment. You can use a virtual environment if you don’t want to install all of masonite’s dependencies on your systems Python.

python -m venv venv
.\venv\Scripts\activate
Enter fullscreen mode Exit fullscreen mode

Installing Masonite

Now we can install Masonite using the pip command. This will give us access to masonite’s craft command, which we can use to finish the installation steps for us. you can do so by running:

pip install masonite
Enter fullscreen mode Exit fullscreen mode

Once Masonite installs you will now have access to the craft command-line tool. The craft command will become your best friend during your development.

You can ensure Masonite and craft are installed correctly by running:

craft
Enter fullscreen mode Exit fullscreen mode

You should see a list of a few commands like install and new

Creating our Project
From the commands you saw above, we will be using new command to create our project. To create a new project, just run:

craft new
Enter fullscreen mode Exit fullscreen mode

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 need to go into our new project directory and install the dependencies in our requirements.txt file

Now that Masonite has been successfully installed, there will be more commands available in the craft. You can check it out by running

craft
Enter fullscreen mode Exit fullscreen mode

Running The Server

Our setup is complete; all that is left to do is to run our server and view our new masonite-powered Website in the Browser. So we get that done by running:

craft serve
Enter fullscreen mode Exit fullscreen mode

The command will prepare everything for us and provide an address we can use to view our new website in the browser.

Note!
When coming to your address in the command prompt, do not use CTR + c as it will stop the server that is currently running. Instead, highlight, right-click, and copy the address.

masonite demo project

That is it. You have set up your first website with masonite. Feel free to add your comments for further discussion.

Top comments (0)