1

I am having trouble setting up my flask application in Project 1. Here is some additional screenshots of the error messages I get in browser when running flask. Here is some additional info:

  • Running Mac OX Mojave version 10.14.4 and using bash command line
  • Able to connect to Adminer tool
  • Able to connect to heroku and View Credentials to obtain URI for flask environment
  • Confirmed all required packages are installed with pip3 install -r v requirements.txt
  • Tried using home-brew to update SSL
  • Tried Uninstalling psycopg2 library and installing psycopg2-binary library with pip

application.py Code:

import os

from flask import Flask, session
from flask_session import Session
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker

app = Flask(__name__)

# Check for environment variable
if not os.getenv("DATABASE_URL"):
    raise RuntimeError("DATABASE_URL is not set!!!")

# Configure session to use filesystem
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)

# Set up database
engine = create_engine(os.getenv("DATABASE_URL"))
db = scoped_session(sessionmaker(bind=engine))


@app.route("/")
def index():
    return "Project 1: TODO"
Bash Command Prompt:

Stephens-MacBook-Pro:Project1 stephen$ export FLASK_APP=application.py
Stephens-MacBook-Pro:Project1 stephen$ export FLASK_DEBUG=1
Stephens-MacBook-Pro:Project1 stephen$ DATABASE_URL="postgres://qipeqvvmvvcoqf:1c6aaa3504a58aa2b9be46b85d79a05159f5ccb1f64e3e27070a024a02c3b83e@ec2-174-129-208-118.compute-1.amazonaws.com:5432/d3lrnl0okcg99k"
Stephens-MacBook-Pro:Project1 stephen$ flask run
 * Serving Flask app "application.py" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 334-645-143

Error Message I receive

0

The OS X El Capitan and later bundles SIP restricting root user account and as a result the /usr/lib is no longer writable. Try

sudo ln -s /Library/PostgreSQL/9.3/lib/libssl.1.0.0.dylib /usr/local/lib/
sudo ln -s /Library/PostgreSQL/9.3/lib/libcrypto.1.0.0.dylib /usr/local/lib/

Do replace the /Library/PostgreSQL/9.3/ with the location of psql installation, which could be found using which qsql.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .