Deploy masonite app on Heroku 2020

Masonite masonite is a web framework made by Python. Official documentation and tutorials are also available, so it's fairly easy to get started.

Preparation

I used virtualenv for the Python environment.

$ sudo apt install python3-dev python3-pip libssl-dev build-essential python3-venv
$ mkdir masonite_tutorial && cd masonite_tutorial/
$ virtualenv -p python3.6 venv
$ source venv/bin/activate

Next, install masonite. You can create a masonite project with the craft new command.

$ pip3 install masonite
$ craft new

To start the server, use the following command.

$ craft serve

If you access http: // localhost: 8000, the following screen will appear.

root.png

Addition of login function

Since the above page is not enough, we will add a user registration / login function.

$ craft auth

Set up the database. I think there is an .env file, so edit it as follows. Don't forget to create a database in your local postgres before that!

DB_CONNECTION=postgres
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=hello_masonite_dev
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_LOG=True

Once that's done, the following command

$ craft migrate

This completes the function addition. You can register as a user from http: // localhost: 8000 / register.

register.png

If you give the code to git so far and make it a template, it may be convenient to use it in the future.

Heroku

Add Procfile

web: gunicorn -w 2 wsgi:application

Deploying to heroku was done from a command.

$ heroku git:remote -a masonite-app
$ git push heroku master 
$ heroku run craft migrate

Make the following settings after deploying.

--Add postgreSQL --The url issued after adding postgreSQL is as follows, so decompose it and set it in the environment variable. - postgres://DB_USERNAME:DB_PASSWORD@DB_HOST:DB_PORT/DB_DATABASE --Environment variable settings (Refer to your env file for the value of each environment variable) - KEY - APP_DEBAG - DB_CONNECTION - DB_HOST - DB_PORT - DB_DATABASE - DB_USERNAME - DB_PASSWORD - DB_LOG

reference

Recommended Posts

Deploy masonite app on Heroku 2020
Deploy Flask app on heroku (bitterly)
Deploy the Flask app on Heroku
Deploy the Flask app on heroku
Deploy the Django app on Heroku [Part 2]
Deploy the Django app on Heroku [Part 1]
Deploy your Django application on Heroku
(Failure) Deploy a web app made with Flask on heroku
Django Heroku Deploy 1
Deploy Django api on heroku (personal note)
shimehari on heroku
Django Heroku Deploy 2
How to deploy a Django app on heroku in just 5 minutes
Deploy a Python 3.6 / Django / Postgres web app on Azure
Deploy a Django application on Google App Engine (Python3)
Deploy a Django app made with PTVS on Azure
Miscellaneous notes about deploying the django app on Heroku
Deploy a web app created with Streamlit to Heroku
How to deploy a web app made with Flask to Heroku
Looking back on iOS'Healthcare App' 2019
How to deploy the easiest python textbook pybot on Heroku
Deploy your Go app on Google App Engine with GitHub Actions
Deploy django project to heroku
Steps to deploy EMLauncher on CentOS 8
Use Numpy, Scipy, scikit-learn on Heroku
Run the app with Flask + Heroku
How to deploy django-compressor on Windows
python + django + scikit-learn + mecab (1) on heroku
How to run matplotlib on heroku
Implement a Django app on Hy
Detect app releases on the App Store
python + django + scikit-learn + mecab (2) on heroku
Publish DJango page on heroku: Practice
Python json.loads () returns str on Heroku
Use ndb.tasklet on Google App Engine
Django blog on heroku: login implementation
Periodically run Python on Heroku Scheduler
Deploy Python face recognition model on Heroku and use it from Flutter ②
Deploy a Python app on Google App Engine and integrate it with GitHub
Until you deploy a SpringBoot project in Gradle on App Engine Flexible
Build your Django app on Docker and deploy it to AWS Fargate
Deploy Python face recognition model on Heroku and use it from Flutter ①
A story about deploying a Twitter-linked app created using Flask + gunicorn on Heroku
Until you publish (deploy) a web application made with bottle on Heroku