Traceback (most recent call last):
File "app.py", line 14, in <module>
app.config.from_object(os.environ['APP_SETTINGS'])
File "/Users/nihit/Desktop/flask-intro/venv/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'APP_SETTINGS'
I get this errors when I try to run my app.py, my config.py I learning from an online tutorial using flask this is the first few lines of codes in my app folder.
# import the Flask class from the flask module
from flask import Flask, render_template, redirect, \
url_for, request, session, flash
from functools import wraps
from flask.ext.sqlalchemy import SQLAlchemy
# create the application object
app = Flask(__name__)
# config
import os
app.config.from_object(os.environ['APP_SETTINGS'])
# create the sqlalchemy object
db = SQLAlchemy(app)
# import db schema
from models import *
my config.py import os
# default config
class BaseConfig(object):
DEBUG = False
# shortened for readability
SECRET_KEY = 'secret key'
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
class DevelopmentConfig(BaseConfig):
DEBUG = True
class ProductionConfig(BaseConfig):
DEBUG = False
I hope someone can help me to identify what I am doing wrong, I am following this online tutorial to learn , so most of the things are there https://www.youtube.com/watch?v=Up3p20rgWCw&list=PLLjmbh6XPGK5e0IbpMccp7NmJHnN8O1ng&index=28