Reputation: 3625
I've a simple falcon app straight from the getting started example
import falcon
import json
class QuoteResource:
def on_get(self, req, resp):
"""Handles GET requests"""
quote = {
'quote': 'I\'ve always been more interested in the future than in the past.',
'author': 'Grace Hopper'
}
resp.body = json.dumps(quote)
api = falcon.API()
api.add_route('/quote', QuoteResource())
The code is in a file called manage.py
When I try to run gunicorn manage:app
This is what I get
2017-06-04 20:47:18 -0700] [2370] [INFO] Starting gunicorn 19.7.1
[2017-06-04 20:47:18 -0700] [2370] [INFO] Listening at: http://127.0.0.1:8000 (2370)
[2017-06-04 20:47:18 -0700] [2370] [INFO] Using worker: sync
[2017-06-04 20:47:18 -0700] [2373] [INFO] Booting worker with pid: 2373
Failed to find application: 'manage'
[2017-06-04 20:47:18 -0700] [2373] [INFO] Worker exiting (pid: 2373)
[2017-06-04 20:47:18 -0700] [2370] [INFO] Shutting down: Master
[2017-06-04 20:47:18 -0700] [2370] [INFO] Reason: App failed to load.
What am I doing wrong here?
Upvotes: 0
Views: 2311
Reputation: 6063
Not sure whether it is a typo or because of misunderstanding but you should start the application this way:
gunicorn manage:api
But not gunicorn manage:app
The manage:api
option tells to invoke the api
object defined in your manage.py module. Otherwise you need to rename api
variable to app
in your code.
Then you can check that application is running by accessing the following url:
http://localhost:8000/quote
By default the port should 8000
but you need to check it when gunicorn starts. It should be something like this:
[INFO] Listening at: http://127.0.0.1:8000
Upvotes: 1