注:如果Debug = True
它运行得很好
我正在尝试部署我的 django 应用程序
我使用的主要工具我不知道是否需要特殊配置:Stripe(付款方式 - 但它不在我的索引页中,所以不应该是因为它)
Mailgun(但我在我的设置中评论了,我也没有在索引页面中使用,所以可能不是)
Procfile
release: python3 manage.py migrate
web: gunicorn store.wsgi --preload --log-file –
我的环境变量设置器:
from store.settings.base import *
env = environ.Env()
DEBUG = env.bool("DEUBG", False)
SECRET_KEY = env("SECRET_KEY")
DATABASES = {
'default': env.db(),
}
我的设置:
import django_on_heroku
import os
import environ
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent.parent
DEBUG = True
ALLOWED_HOSTS = ['afternoon-brook-19806.herokuapp.com',
'127.0.0.1', 'localhost']
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_DIRS = [BASE_DIR / 'templates/static']
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" # BUG
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
CART_SESSION_ID = 'cart'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
PUBLISHED_KEY = 'pk_live_xxxxxxx'
STRIPE_SECRET_KEY = 'sk_live_xxxxxxxxx?'
STRIPE_ENDPOINT_SECRET = 'xxxxxxx?'
django_on_heroku.settings(locals())
我在 Heroku 日志中收到错误 500:
2022-04-14T04:33:35.002535+00:00 heroku[router]: at=info method=GET path="/account/login/" host=afternoon-brook-19806.herokuapp.com request_id=ac9b6df0-3598-427e-a672-9519419de8b3 fwd="177.124.150.24" dyno=web.1 connect=0ms service=68ms status=500 bytes=451 protocol=https
2022-04-14T04:33:35.003893+00:00 app[web.1]: 10.1.51.13 - - [14/Apr/2022:01:33:35 -0300] "GET /account/login/ HTTP/1.1" 500 145 "https://afternoon-brook-19806.herokuapp.com/account/register/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
2022-04-14T04:33:38.997471+00:00 app[web.1]: 10.1.27.55 - - [14/Apr/2022:01:33:38 -0300] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Windows NT 10.0; Win64;
x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
2022-04-14T04:33:38.998359+00:00 heroku[router]: at=info method=GET path="/" host=afternoon-brook-19806.herokuapp.com request_id=6d72ffac-e046-4315-a304-95f19cbe5d1c fwd="177.124.150.24" dyno=web.1 connect=0ms service=233ms status=500 bytes=451 protocol=https
2022-04-14T04:38:19.705332+00:00 heroku[router]: at=info method=GET path="/" host=afternoon-brook-19806.herokuapp.com request_id=3bd4e671-70e3-45d3-a129-0445e40cac07 fwd="177.124.150.24" dyno=web.1 connect=0ms service=284ms status=500 bytes=451 protocol=https
2022-04-14T04:38:19.707351+00:00 app[web.1]: 10.1.85.250 - - [14/Apr/2022:01:38:19 -0300] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
2022-04-14T04:54:36.969390+00:00 heroku[router]: at=info method=GET path="/account/register/" host=afternoon-brook-19806.herokuapp.com request_id=73c56c19-3f20-45b9-84a2-61cd1af2cbb5 fwd="44.201.124.202" dyno=web.1 connect=0ms service=15ms status=500 bytes=451 protocol=https
2022-04-14T04:54:36.970932+00:00 app[web.1]: 10.1.35.168 - - [14/Apr/2022:01:54:36 -0300] "GET /account/register/ HTTP/1.1" 500 145 "-" "Go-http-client/1.1"2022-04-14T04:54:37.216540+00:00 heroku[router]: at=info method=GET path="/" host=afternoon-brook-19806.herokuapp.com request_id=2bb68b8f-85a3-49a7-9a3c-3199023f1fcf fwd="44.201.124.202" dyno=web.1 connect=0ms service=236ms status=500 bytes=451 protocol=http
2022-04-14T04:54:37.217335+00:00 app[web.1]: 10.1.36.139 - - [14/Apr/2022:01:54:37 -0300] "GET / HTTP/1.1" 500 145 "-" "Go-http-client/1.1"
2022-04-14T04:55:04.990034+00:00 heroku[router]: at=info method=HEAD path="/account/register/" host=afternoon-brook-19806.herokuapp.com request_id=699a6c8a-6c72-49be-985a-03b97425b0cf fwd="217.182.175.162" dyno=web.1 connect=0ms service=20ms status=500 bytes=306 protocol=https
2022-04-14T04:55:04.992336+00:00 app[web.1]: 10.1.85.250 - - [14/Apr/2022:01:55:04 -0300] "HEAD /account/register/ HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36"
2022-04-14T04:57:02.924738+00:00 heroku[router]: at=info method=GET path="/admin/logout/" host=afternoon-brook-19806.herokuapp.com request_id=388154e3-ad25-4388-8d80-44cf8b33882c fwd="177.124.150.24" dyno=web.1 connect=0ms service=52ms status=200 bytes=2188 protocol=https
2022-04-14T04:57:02.926035+00:00 app[web.1]: 10.1.43.191 - - [14/Apr/2022:01:57:02 -0300] "GET /admin/logout/ HTTP/1.1" 200 1629 "https://afternoon-brook-19806.herokuapp.com/admin/product/product/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
2022-04-14T04:57:05.345585+00:00 app[web.1]: 10.1.63.226 - - [14/Apr/2022:01:57:05 -0300] "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
2022-04-14T04:57:05.345636+00:00 heroku[router]: at=info method=GET path="/" host=afternoon-brook-19806.herokuapp.com request_id=8bfd526c-f4e2-45b5-be40-5edbac7514fb fwd="177.124.150.24" dyno=web.1 connect=1ms service=246ms status=500 bytes=451 protocol=https