Getting started with Masonite and Pipenv
Since I like to keep my system Pythons as clean as possible, this is the “low tech” workaround for creating a Masonite project that uses pipenv…
- Create a new directory in which the project should live
- Enter the project directory, and run
pipenv --python #.#
where “#.#” is desired Python version- This lets pipenv create the virtualenv
- Get a shell with the new directory’s venv activated:
pipenv shell
- Install the Masonite CLI:
pipenv install masonite-cli
- Now, delete the project directory
- Then, create the new project with craft:
craft new [project_name]
; be sure project_name matches whatever the new directory was called that you were working with in previous steps - Enter the directory, and create a lock file:
pipenv lock
- Install the masonite dependencies with craft (will use pipenv):
craft install
- And…you’re off!
Adding Authentication
- Ensure database is setup; otherwise you can’t save users
- Scaffold the authentication system:
craft auth
- Create a new secret key and add to .env:
craft key -s
- Run db migrations to create the users table:
craft migrate
- You should now be able to run the dev server and register a test user
Misc Helpful Tidbits
craft list
will display a list of all available commands