Giter VIP home page Giter VIP logo

Comments (7)

di avatar di commented on July 28, 2024 2

Yes, you can use the --debug command line flag or set the DEBUG environment variable to TRUE.

from functions-framework-python.

ilpersi avatar ilpersi commented on July 28, 2024

I saw the --debug TRUE switch in #5 and used it to debug my functions; it does not automatically reload the main.py after I modify it: I have to stop function-framework and start it again

from functions-framework-python.

di avatar di commented on July 28, 2024

Can you give us some more details about how you're trying to run the functions-framework? The following works for me

$ cat main.py
def hello(request):
    return "Hello world!"

$ functions-framework --target hello --debug TRUE
 * Serving Flask app "hello" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
 * Restarting with fsevents reloader
 * Debugger is active!
 * Debugger PIN: 137-358-281

<wrote to main.py>

 * Detected change in '/Users/dustiningram/main.py', reloading
 * Detected change in '/Users/dustiningram/main.py', reloading
 * Restarting with fsevents reloader
 * Debugger is active!
 * Debugger PIN: 137-358-281

$ flask --version
Python 3.7.4
Flask 1.1.1
Werkzeug 0.16.0

from functions-framework-python.

ilpersi avatar ilpersi commented on July 28, 2024

Hi Dustin, here is a video of what I am doing: https://drive.google.com/file/d/1BJx4Bmc2YN4sgLTKDRSbqo-EdX1TZomj/preview

Is there any other detail that can help you?

from functions-framework-python.

di avatar di commented on July 28, 2024

Hi @ilpersi, thanks for the very detailed video! One difference is that Flask/Werkzeug is using the "stat" reloader on your machine, but I'm using "fsevents" which comes from the watchdog package.

It seems like what Flask uses varies from one platform to another. Could you try installing watchdog in your environment and see if that helps?

Also if you could include the output of flask --version that'd be great. Thanks!

from functions-framework-python.

ilpersi avatar ilpersi commented on July 28, 2024

@di installing watchdog solves the issue! 🔝 👍

Here is my flask --version

Python 3.7.4
Flask 1.1.1
Werkzeug 0.16.0

I think that Flask version is also something that deserves more documentation: to stick with the cloud functions runtime I originally installed 1.0.2. and I updated to 1.1.1 after you posted your flask --version as an attempt to fix the issue.

The video in the previous comment is shot with 1.1.1 and installing watchdog fixes the issue both with 1.0.2 and 1.1.1 (I tested them both).

Thank you very much.

from functions-framework-python.

di avatar di commented on July 28, 2024

FYI, once #15 is released, this will just be a flag (--debug) instead of an option (--debug TRUE).

from functions-framework-python.

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.