Giter Club home page Giter Club logo

Comments (8)

viniciuschiele avatar viniciuschiele commented on July 18, 2024

I think you should use with with app.app_context():

Is this code a unit test? If so, why do you need a Flask App?

Could you provide me a full example?

Thanks!

from flask-apscheduler.

ddurieux avatar ddurieux commented on July 18, 2024

I have found a solution, so I think we can close this ;)

from flask-apscheduler.

jcxmej avatar jcxmej commented on July 18, 2024

@ddurieux would have been helpful if you could have shared your solution before closing the issue.. thanks.

from flask-apscheduler.

vijay-axis avatar vijay-axis commented on July 18, 2024

@ddurieux please share the solution. Thank you

from flask-apscheduler.

ddurieux avatar ddurieux commented on July 18, 2024

Yep, sorry for the delay,

I add jobs in config and load the config by eve: https://github.com/Alignak-monitoring-contrib/alignak-backend/blob/develop/alignak_backend/app.py#L1829-L1874

I have a file with the scheduler functions: https://github.com/Alignak-monitoring-contrib/alignak-backend/blob/develop/alignak_backend/scheduler.py

from flask-apscheduler.

vijay-axis avatar vijay-axis commented on July 18, 2024

@ddurieux Thank you

from flask-apscheduler.

Guibod avatar Guibod commented on July 18, 2024

This was not really helpful, let me explain it my way:

You should expose your APP as variable in one of your application module. For instance, in your app.py you don't expose a create_app() but a live app instance instead.

Then you do a local import of this application in your scheduled function:

def job1():
    from mylib.app import app
    app.logger.error('FUFU!')

At the moment i try to understand if it is not better to call with app.application_context():
Anyway this solution is simple.

from flask-apscheduler.

caio-vinicius avatar caio-vinicius commented on July 18, 2024

I was using request.post, request.put instead of requests.post, requests.put.

from flask-apscheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.