Heroku Flask Postgres Database Deployment walkthrough from SQLite3

Publié le: 25 août 2020
sur la chaîne: Vincent Stevenson
8,345
127

I show how to start up a Postgres database on Heroku for your Flask Web application and the steps you will take to migrate from a SQLite3 db.
Steps:
1. Create an empty GitHub repo
2. Link the GitHub repo to your Heroku app
3. Enable automatic deployments in Heroku
4. Provision the Postgres add on in your Heroku open - this creates a free database for your app
5. Confirm the Config Var (environment variable) for DATABASE_URL has been created in your Heroku app
6. Put this DATABASE_URL into your web app's config directory
7. Install psycopg2 package (this is for postgres to work with your Flask app)
8. Recreate your requirements.txt file (pip freeze ... requirements.txt)
9. Create a file in your project dir called db_create.py with the following code: from app import db
db.create_all()
10. Commit and push these changes to your GitHub repo
11. Within your Heroku app, you will need to open the Heroku console and run the db_create.py file you just created so that Heroku can create the tables in the Postgres db that was just created for your app.


Sur cette page du site, vous pouvez voir la vidéo en ligne Heroku Flask Postgres Database Deployment walkthrough from SQLite3 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Vincent Stevenson 25 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 8,345 fois et il a aimé 127 téléspectateurs. Bon visionnage!