installing masonite on ubuntu 24
Installing the Masonite framework on Ubuntu 24.04 involves setting up Python dependencies, creating a virtual environment, and installing the framework using
pip. Prerequisites
Before installing, ensure your Ubuntu system is updated and has the necessary development tools, Python, and
pip installed. sudo apt update
sudo apt install python3-dev python3-pip libssl-dev build-essential python3-venv
Installation Steps
- Create a Project Directory
Navigate to the directory where you want to store your project:mkdir ~/myapp cd ~/myapp - Set Up a Virtual Environment (Recommended)
Create and activate a virtual environment to avoid conflicts with system-wide packages:python3 -m venv venv source venv/bin/activate - Install Masonite
Install the core Masonite framework:pip install masonite - Create a New Project
Initialize a new Masonite project in the current directory:craft new # or to specify a name # project start my_project - Install Project Dependencies
Install the dependencies listed in your project'srequirements.txtfile:pip install -r requirements.txt # Alternatively, if you used 'project start' # project install - Run the Server
Start the development server to confirm installation:
Access your application atpython craft servehttp://localhost:8000/.
Troubleshooting
- Command
craftnot found: If thecraftcommand is not recognized, ensure you are in the virtual environment. Alternatively, try running it withpython craft serve. - Permission Errors: If you did not use a virtual environment, use the
--userflag:pip install masonite --user