From 3ea945b99ff2cdacb565f64274830d5fe05234e7 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 28 Mar 2022 17:41:54 -0500 Subject: [PATCH] Add psycopg2 to Pipfile for SQLAlchemy Postgresql support I'm not sure why this isn't installed automatically, but I guess in order to make sure tons of unused dependencies aren't installed on machines that don't need them as well as all the errors that crop up, it wasn't added. As a user who's simply using it for deployment and didn't need it for local development, I suppose this is what happens. --- Pipfile | 1 + Pipfile.lock | 19 ++++++++++++++++++- app.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index a19662d..a3bba7c 100644 --- a/Pipfile +++ b/Pipfile @@ -13,6 +13,7 @@ pytz = "*" faker = "*" humanize = "*" gunicorn = "*" +psycopg2 = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index 3c48218..ff4a891 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "dd2fc4ce524f938712d6eeef0a31be717e8b640fc33fd94260973f34c773e260" + "sha256": "e51737b38157b4d1e2b57226a5a07dbce7558baeef5895e41cede4d2809de74b" }, "pipfile-spec": 6, "requires": { @@ -211,6 +211,23 @@ "markers": "python_version >= '3.7'", "version": "==2.1.1" }, + "psycopg2": { + "hashes": [ + "sha256:06f32425949bd5fe8f625c49f17ebb9784e1e4fe928b7cce72edc36fb68e4c0c", + "sha256:0762c27d018edbcb2d34d51596e4346c983bd27c330218c56c4dc25ef7e819bf", + "sha256:083707a696e5e1c330af2508d8fab36f9700b26621ccbcb538abe22e15485362", + "sha256:34b33e0162cfcaad151f249c2649fd1030010c16f4bbc40a604c1cb77173dcf7", + "sha256:4295093a6ae3434d33ec6baab4ca5512a5082cc43c0505293087b8a46d108461", + "sha256:8cf3878353cc04b053822896bc4922b194792df9df2f1ad8da01fb3043602126", + "sha256:8e841d1bf3434da985cc5ef13e6f75c8981ced601fd70cc6bf33351b91562981", + "sha256:9572e08b50aed176ef6d66f15a21d823bb6f6d23152d35e8451d7d2d18fdac56", + "sha256:a81e3866f99382dfe8c15a151f1ca5fde5815fde879348fe5a9884a7c092a305", + "sha256:cb10d44e6694d763fa1078a26f7f6137d69f555a78ec85dc2ef716c37447e4b2", + "sha256:d3ca6421b942f60c008f81a3541e8faf6865a28d5a9b48544b0ee4f40cac7fca" + ], + "index": "pypi", + "version": "==2.9.3" + }, "python-dateutil": { "hashes": [ "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", diff --git a/app.py b/app.py index ac70f35..00c569a 100644 --- a/app.py +++ b/app.py @@ -8,7 +8,6 @@ from faker import Faker from flask import Flask, render_template, request from flask_login import LoginManager, current_user from flask_sqlalchemy import SQLAlchemy -# init SQLAlchemy from werkzeug.security import generate_password_hash db = SQLAlchemy() @@ -23,6 +22,7 @@ def create_app(): app.config['SECRET_KEY'] = 'secret key goes here' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite' + # Heroku deployment if app.config['ENV'] == 'production': app.config['SECRET_KEY'] = os.getenv('SECRET_KEY') app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL').replace('postgres://', 'postgresql://', 1)