You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Almenon edited this page Feb 15, 2019
·
5 revisions
There are two ways you can use AREPL with web frameworks:
1. Extract code from your web framework into a arepl session and mock the input
This approach works with anything. Just highlight the code you want to test, use the "open highlighted code in new arepl session" command, and mock the input.
2. Add your web framework library to pyGuiLibraries in the settings.
This will activate restart mode, so each time you make a change the webservice will restart.
Make sure you call the webservice through the code rather than the command line. For example, in flask you would use app.run().
fromarepldumpimportdumpfromflaskimportFlaskapp=Flask(__name__)
@app.route("/<a>")defhello(a):
html="<b>Hello World!</b>"dump() # use this to inspect the state of your local variablesreturnhtmlapp.run()
AREPL would show the following output at first:
Print Output:
* Running on https://127.0.0.1:5000/ (Press CTRL+C to quit)
-{
}
If you go to the url you will get a 404 not found. Don't worry! Your method requires a argument, so append a random word to the url. For example, https://127.0.0.1:5000/fallafel
It's a open field from here on out - have fun! If you want you can follow the official flask tutorial
3. Use something else entirely.
I suggest trying birdseye. You just add a birdseye annotation to the function you want to debug and when it's called birdseye records your variable and inputs in a very nice fashion.