Reputation: 5516
This is my app structure
project/
app/
manage.py
server/
gunicorn_config.py
start_gunicorn.sh
This is my start_gunicorn.sh
#!/bin/bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
CONFIG=$DIR/gunicorn_config.py
source $DIR/../v_env/bin/activate
gunicorn -c $CONFIG $DIR/../app/manage:app &
This fails with the messaage:
ImportError: No module named '/sys/path/project/server/'
I have tried variations of the above, and searched online as well, but I could not find a way to do it. Is this possible? The main reason is because I want my pid
file under the server directory, its currently set as pid="server.pid"
inside gunicorn_config.py
.
Upvotes: 3
Views: 3535
Reputation: 10850
gunicorn expects a module:variable
to be passed as the command line argument, not a path that you're passing ($DIR/../app/manage:app
).
Is there a reason you want the pid file there? And tangentially, is there a reason to not use supervisor or something similar to run gunicorn instead of &
?
Upvotes: 1