Environment set up for running a falcon app
Asked Answered
E

1

8

I've a simple falcon app which I'm running on the terminal using the following command,

gunicorn -b 0.0.0.0:5000 main:app --reload

main.py is the python file which instantiates app = falcon.API(). This works.

So I tried to set this config inside of PyCharm. But this I can't get to run. Here's the PyCharm config window

enter image description here

Can someone help me configure this window to get the app running.

Ewell answered 23/11, 2017 at 23:3 Comment(0)
F
10

Looks like you almost got it right already, except you need to set the script to the gunicorn of your virtual environment, and put the parameters in the appropriate input box.

Use the "three dots" button to the right of the script input box, and navigate to the virtual environment, there you should find a bin/ directory, inside there should be gunicorn. Selecting this should have you end up with your input box like this:

/path/to/virtualenv/bin/gunicorn

No parameters, these go into the script parameters input box below like this:

-b 0.0.0.0:5000 main:app

In the input box working directory, you set it to the working directory of your app, like this:

/path/to/appdirectory

It is possible that you need to enable gevent compatible for the debugger, which you can set in File > Settings > Build, Execution, Deployment > Python Debugger with a checkbox.

Forceps answered 24/11, 2017 at 0:33 Comment(2)
thanks for that, I though wrapped everything into a java main function and just called the script.Ewell
This worked for uvicorn as well.Polysynthetic

© 2022 - 2024 — McMap. All rights reserved.