我正在尝试将Python中制作的API部署到Heroku。我得到了这个错误,但我不知道如何修复它们。
at=error code=H10 desc="App crashed" method=GET path="/" host=pythonapisfind.herokuapp.com request_id=a0e39942-e0d5-4159-87fa-b06e997122b6 fwd="217.97.50.218" dyno= connect= service= status=503 bytes= protocol=https
2020-12-09T09:06:17.055412+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pythonapisfind.herokuapp.com request_id=b76f9c8c-a187-4516-9338-f01bca9eb726 fwd="217.97.50.218" dyno= connect= service= status=503 bytes= protocol=httpsfrom pathlib import Path
from environ import Env
BASE_DIR = Path(__file__).resolve().parent.parent
env = Env()
env.read_env(env_file='.env')
SECRET_KEY = env('DJANGO_SECRET_KEY')
DEBUG = env.bool('DJANGO_DEBUG')
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'drf_yasg',
'corsheaders',
'rest_framework',
'apps.core',
'apps.offers'
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'project.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'project.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': env("DATABASE_NAME"),
'USER': env("DATABASE_USER"),
'PASSWORD': env("DATABASE_PASSWORD"),
'HOST': env("DATABASE_HOST"),
'PORT': env("DATABASE_PORT"),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
ALLOWED_HOSTS = ['pythonapisfind.herokuapp.com', '127.0.0.1']
CORS_ORIGIN_ALLOW_ALL = Trueasgiref==3.3.1
certifi==2020.12.5
chardet==3.0.4
coreapi==2.3.3
coreschema==0.0.4
Django==3.1.4
django-cors-headers==3.5.0
django-environ==0.4.5
djangorestframework==3.12.2
drf-yasg==1.20.0
idna==2.10
inflection==0.5.1
itypes==1.2.0
Jinja2==2.11.2
MarkupSafe==1.1.1
packaging==20.7
postgres==3.0.0
psycopg2-binary==2.8.6
psycopg2-pool==1.1
pyparsing==2.4.7
pytz==2020.4
requests==2.25.0
ruamel.yaml==0.16.12
ruamel.yaml.clib==0.2.2
sqlparse==0.4.1
uritemplate==3.0.1
urllib3==1.26.2
gunicorn ==20.0.4Lorem Ipsum只是印刷和排版行业的虚拟文本。自15世纪以来,Lorem Ipsum一直是业界的标准虚拟文本,当时一家不知名的印刷商拿出了一个排版,然后把它弄乱了,做成了一个排版样本簿。它不仅存活了五个世纪,还经历了电子排版的飞跃,基本上保持不变。它在20世纪60年代随着包含Lorem Ipsum段落的Letraset sheets的发布而流行起来,最近又随着包括Lorem Ipsum版本的桌面出版软件Aldus PageMaker而流行起来。

发布于 2020-12-09 20:04:37
您的wsgi.py在设置位置的设置错误
变化
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')至
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') https://stackoverflow.com/questions/65213681
复制相似问题