简体   繁体   English

heroku应用程序必须与django项目共享相同的名称吗?

[英]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 ? 我应该改变shworkoutworkout

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.

相关问题 我的Django应用程序必须与项目目录名称相同吗? - Does my Django app have to be the same name as the project directory? 在“Django 项目名称”中找不到属性“应用程序”。 Heroku 应用部署 - Failed to find attribute 'application' in 'Django project name'. Heroku app deploy Django 1.7 - 应用“your_app_name”没有迁移 - Django 1.7 - App 'your_app_name' does not have migrations 为什么我会收到“CommandError: App 'app_name' 没有迁移。” 什么时候使用 Heroku? - Why do I get “CommandError: App 'app_name' does not have migrations.” when using Heroku? Django项目在heroku中不显示图像 - Django project does not display images in heroku heroku 不支持 django 应用程序并引发错误 - heroku does not support django app and raise the error 为什么Django将2个文件夹命名为项目名称? - Why does Django name 2 folders the project name? 如何在Django中从项目级别包导入而又不与同名的应用程序级别模块冲突? - How to import from project level package in Django without conflicting with app level module with same name? 如何将现有的Django应用程序/项目部署/迁移到Heroku上的生产服务器? - How to deploy / migrate an existing django app / project to a production server on Heroku? 将django页面共享给没有帐户的用户 - Share django page to user who does not have an account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM