質問

I'm trying to run the twoscoopsofdjango skeleton on Heroku via Gunicorn.

Here is the file tree from the root of the project (left out a few unimportant folders for readability):

.
├── LICENSE.txt
├── my_project
│   ├── manage.py
│   ├── my_project
│   │   ├── __init__.py
│   │   ├── settings
│   │   │   ├── base.py
│   │   │   ├── __init__.py
│   │   │   ├── local.py
│   │   │   ├── production.py
│   │   │   └── test.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   └── templates
│       ├── 404.html
│       ├── 500.html
│       └── base.html
├── README.rst
├── requirements
│   ├── base.txt
│   ├── local.txt
│   ├── production.txt
│   └── test.txt
└── requirements.txt

Now I need to run Gunicorn as if it was run from the my_project folder in the following shortened tree:

.
├── LICENSE.txt
├── my_project
│   ├── manage.py

However, I need to give the command from the project root because a Heroku Procfile is only picked up on the lowest level of the project root.

So inside a shell locally I would just cd my_project and then run gunicorn my_project.wsgi --settings=my_project.settings.production. But I don't know how to do this from a Procfile.

And just for your information gunicorn --pythonpath=my_project my_project.wsgi --settings=my_project.settings.production does not work either.

役に立ちましたか?

解決

Seems like I had to run heroku ps:scale web=1 to get it working properly. This is strange because I am 100% sure I started other Heroku projects before and I didn't have to run that command in order to see my application working in http://my_project.herokuapp.com.

My Procfile looked like this when it ran successfully:

web: cd my_project; gunicorn my_project.wsgi --settings=my_project.settings.production

Edit

I previously ran gunicorn with the -w 1 option:

web: cd my_project; gunicorn my_project.wsgi -w 1 --settings=my_project.settings.production

That probably activated a dyno.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top