Skip to content

HeyItWorked/code_snippets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code_snippets

Flask-SQLAlchemy Version 3.0.0 update

  • An active Flask application context is always required to access session and engine, regardless of if an application was passed to the constructor.
  • Without an application context, creating db from terminal will raise RuntimeError: Working outside of application context. when you try to invoke db.create_all() from python interpreter.
  • To counteract this issue, two solutions are presented:
    1. flask shell offers made-ready app context and instance to create db.
    2. Import app from FlaskBlog and create db under app context:
    from flaskblog import app
    with app.app_context():
        db.create_all()
    

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 70.1%
  • Python 15.0%
  • HTML 13.5%
  • CSS 1.4%
  • Shell 0.0%
  • JavaScript 0.0%