Guest User

Untitled

a guest
Feb 22nd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. $ python manage.py runserver
  2. Traceback (most recent call last):
  3. File "manage.py", line 5, in <module>
  4. from app import app, db
  5. File "C:a1wordcountapp.py", line 7, in <module>
  6. app.config.from_object(os.environ['APP_SETTINGS'])
  7. File "C:UsersUserAppDataLocalProgramsPythonPython36-32libos.py", line 669, in __getitem__
  8. raise KeyError(key) from None
  9. KeyError: 'APP_SETTINGS'
  10.  
  11. from flask import Flask, render_template
  12. from flask_sqlalchemy import SQLAlchemy
  13. import os
  14.  
  15.  
  16. app = Flask(__name__)
  17. app.config.from_object(os.environ['APP_SETTINGS'])
  18. app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
  19. db = SQLAlchemy(app)
  20.  
  21. from models import Result
  22.  
  23. @app.route('/', methods=['GET', 'POST'])
  24. def index():
  25. return render_template('index.html')
  26.  
  27. if __name__ == '__main__':
  28. app.run()
  29.  
  30. import os
  31. from flask_script import Manager
  32. from flask_migrate import Migrate, MigrateCommand
  33.  
  34. from app import app, db
  35.  
  36.  
  37. app.config.from_object(os.environ['APP_SETTINGS'])
  38.  
  39. migrate = Migrate(app, db)
  40. manager = Manager(app)
  41.  
  42. manager.add_command('db', MigrateCommand)
  43.  
  44.  
  45. if __name__ == '__main__':
  46. manager.run()
Add Comment
Please, Sign In to add comment