Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Italo Maia
    @imaia
    which is not within the application context
    don't do it like that
    setup configuration in the config module
    Amer Grgic
    @agrgic
    well I did setup my configuration in config.py
    if that's what you mean
    but I think I know what's going on
    because if I import the controllers after app = Blueprint etc.
    it works
    never mind my comment above, that's not true
    :-)
    so ok, I have a TWILIO_NR setup in my Dev class in config.py, how would I call it in my views.py and controllers.py?
    Amer Grgic
    @agrgic
    @imaia
    Italo Maia
    @imaia
    current_app.config["TWILIO_NR"]
    Amer Grgic
    @agrgic
    Yeah, but that does not work in my controllers.py @imaia
    Because of the error above, maybe im missing something, an import or something
    Amer Grgic
    @agrgic
    grr :(
    Amer Grgic
    @agrgic
    any ideas, I'm kind of running out of options @imaia @italomaia
    Italo Maia
    @imaia
    @agrgic do not access current_app outside your views; do not modify it outside your views
    views -> function views
    Amer Grgic
    @agrgic
    ah
    I get it
    damn
    ok that was stupid
    awsumco
    @awsumco
    Hi, whats would be the best way to Flask-Login and Flask-Security with flask-empty ?
    Italo Maia
    @italomaia
    best way? What do you mean, @awsumco
    just load it as an extension and make do
    flask-security uses flask-login
    also, flask-security has a fork called flask-security-fork which has a few nice extras
    awsumco
    @awsumco
    Sorry my question was unclear and also before I played around with blueprints and the default app.
    Back track a bit here, I am new to the whole modular blueprint flask app thing, i just slap views and models into app and I am going. I like the idea of apps/things_does_something. What I am having trouble is the logic of how flask reads things in. For example you said load as an extension. I am fuzzy here does that go in the config.py under extensions and how is called from the blue print.
    See I a more stuck on how the project is laid out and best practice for the project, sorry about the wall of text.
    Italo Maia
    @italomaia
    @awsumco you can set in config which extensions should be loaded using a full path (str)
    in this example, 'extensions.db' is a path to the extension instance that you wish to load
    flask-empty will load "db" from you "extensions" module and initialize it with your Flask instance
    In your extensions.py, you could have something like this:
    from flask_sqlalchemy import SQLAlchemy
    db = SQLAlchemy()