[英]Does heroku app have to share the same name as django project?
I'm trying to deploy an app that I started with django-admin startproject workout
. 我正在尝试部署以
django-admin startproject workout
开始的应用程序。 Months later, it was time to deploy, workout
was not an available name for heroku apps. 几个月后,是时候部署了,
workout
不是heroku应用程序的可用名称。 Thus, I decided on shworkout
. 因此,我决定进行
shworkout
。 Now, I'm having problems with the deployment. 现在,我在部署方面遇到了问题。 Take a look at this traceback:
看一下此回溯:
2018-01-15T13:50:49.922410+00:00 heroku[web.1]: Starting process with command `gunicorn shworkout.wsgi --log-file -`
2018-01-15T13:50:52.274803+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [4] [INFO] Starting gunicorn 19.7.1
2018-01-15T13:50:52.275393+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [4] [INFO] Listening at: http://0.0.0.0:57296 (4)
2018-01-15T13:50:52.275484+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [4] [INFO] Using worker: sync
2018-01-15T13:50:52.278566+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [8] [INFO] Booting worker with pid: 8
2018-01-15T13:50:52.283407+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [8] [ERROR] Exception in worker process
2018-01-15T13:50:52.283421+00:00 app[web.1]: Traceback (most recent call last):
2018-01-15T13:50:52.283428+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
2018-01-15T13:50:52.283430+00:00 app[web.1]: worker.init_process()
2018-01-15T13:50:52.283431+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
2018-01-15T13:50:52.283433+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
2018-01-15T13:50:52.283432+00:00 app[web.1]: self.load_wsgi()
2018-01-15T13:50:52.283434+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-01-15T13:50:52.283443+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2018-01-15T13:50:52.283441+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-01-15T13:50:52.283442+00:00 app[web.1]: self.callable = self.load()
2018-01-15T13:50:52.283446+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-01-15T13:50:52.283448+00:00 app[web.1]: __import__(module)
2018-01-15T13:50:52.283444+00:00 app[web.1]: return self.load_wsgiapp()
2018-01-15T13:50:52.283445+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-01-15T13:50:52.283449+00:00 app[web.1]: ModuleNotFoundError: No module named 'shworkout'
2018-01-15T13:50:52.315187+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [4] [INFO] Reason: Worker failed to boot.
2018-01-15T13:50:52.283447+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
2018-01-15T13:50:52.283527+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [8] [INFO] Worker exiting (pid: 8)
2018-01-15T13:50:52.315111+00:00 app[web.1]: [2018-01-15 13:50:52 +0000] [4] [INFO] Shutting down: Master
2018-01-15T13:50:52.401600+00:00 heroku[web.1]: Process exited with status 3
2018-01-15T13:50:52.415493+00:00 heroku[web.1]: State changed from starting to crashed
The lines 线
File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2018-01-15T13:50:52.283449+00:00 app[web.1]: ModuleNotFoundError: No module named 'shworkout'
are what catch my attention the most. 最吸引我注意的是 My guess is this: gunicorn is looking for a wsgi.py file (it's in
/workout
), but it's looking for it in the wrong place, namely, a folder called /shworkout
. 我的猜测是:gunicorn正在寻找wsgi.py文件(位于
/workout
),但在错误的位置寻找它,即名为/shworkout
的文件夹。 Such a folder doesn't exist in my project. 这样的文件夹在我的项目中不存在。
shworkout
is only a name for my app on heroku . shworkout
只是我在heroku上的应用程序的名称。
So, is this a correct explanation? 所以,这是一个正确的解释? What to do about it then?
那该怎么办呢? And if I'm wrong, what is really going on here?
如果我错了,那么这里到底发生了什么?
Procfile : Procfile :
web: gunicorn shworkout.wsgi --log-file -
Should I change shworkout
to workout
? 我应该改变
shworkout
来workout
?
wsgi.py : wsgi.py :
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "workout.settings.production")
application = get_wsgi_application()
I was using a faulty Procfile. 我使用的是错误的Procfile。 Changed from:
更改自:
web: gunicorn shworkout.wsgi --log-file -
to 至
web: gunicorn workout.wsgi --log-file -
Explanation: 说明:
the Procfile should point to the location of the wsgi.py file, which is in /workout
, not in /shworkout
. Procfile应该指向wsgi.py文件的位置,该文件位于
/workout
,而不是在/shworkout
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.