编辑:
我在 pipfile 中包含了所有需求并删除了 requirements.txt 文件。看起来应用程序现在可以工作,但卡在“未找到。在此服务器上找不到请求的资源”(下面 Heroku 日志中的第 24 行)。我已经更新了 Heroku 日志、pipfile、Procfile 和 settings.py:
Procfile
web: gunicorn myquiz.wsgi --log-file -
pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
djangorestframework = "==3.12.2"
django-nested-admin = "==3.3.3"
asgiref = "==3.3.1"
click = "==7.1.2"
dj-database-url = "==0.5.0"
django-cors-headers = "==3.7.0"
django-heroku = "==0.3.1"
gunicorn = "==20.0.4"
itsdangerous = "==1.1.0"
psycopg2 = "==2.7.7"
python-decouple = "==3.4"
python-monkey-business = "==1.0.0"
pytz = "==2021.1"
six = "==1.15.0"
sqlparse = "==0.4.1"
whitenoise = "==5.2.0"
Django = "==3.1.6"
Flask = "==1.1.2"
Jinja2 = "==2.11.3"
MarkupSafe = "==1.1.1"
Werkzeug = "==1.0.1"
[requires]
python_version = "3.7"
Settings.py
import os
import django_heroku
import dj_database_url
from decouple import config
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ''
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['myquiz-20192020.herokuapp.com', '127.0.0.1']
# Application definition
INSTALLED_APPS = [
'rest_framework',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'quizzes',
'nested_admin',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'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 = 'myquiz.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, "TEMPLATES")],
'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 = 'myquiz.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/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.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
### Sessions
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
MEDIA_URL = '/images/'
# Extra places for collectstatic to find static files #
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
django_heroku.settings(locals())
Heroku 日志 --tail
2021-02-06T05:48:46.000000+00:00 app[api]: Build started by user myemail@gmail.com
2021-02-06T05:49:50.182826+00:00 app[api]: Release v50 created by user myemail@gmail.com
2021-02-06T05:49:50.182826+00:00 app[api]: Deploy cde348a6 by user myemail@gmail.com
2021-02-06T05:49:50.754717+00:00 heroku[web.1]: Restarting
2021-02-06T05:49:50.758453+00:00 heroku[web.1]: State changed from up to starting
2021-02-06T05:49:51.838368+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-02-06T05:49:51.924678+00:00 app[web.1]: [2021-02-06 05:49:51 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-02-06T05:49:51.924700+00:00 app[web.1]: [2021-02-06 05:49:51 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-02-06T05:49:51.924848+00:00 app[web.1]: [2021-02-06 05:49:51 +0000] [4] [INFO] Handling signal: term
2021-02-06T05:49:52.125735+00:00 app[web.1]: [2021-02-06 05:49:52 +0000] [4] [INFO] Shutting down: Master
2021-02-06T05:49:52.213682+00:00 heroku[web.1]: Process exited with status 0
2021-02-06T05:50:01.596314+00:00 heroku[web.1]: Starting process with command `gunicorn myquiz.wsgi --log-file -`
2021-02-06T05:50:04.671514+00:00 app[web.1]: [2021-02-06 05:50:04 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-02-06T05:50:04.672057+00:00 app[web.1]: [2021-02-06 05:50:04 +0000] [4] [INFO] Listening at: http://0.0.0.0:31749 (4)
2021-02-06T05:50:04.672145+00:00 app[web.1]: [2021-02-06 05:50:04 +0000] [4] [INFO] Using worker: sync
2021-02-06T05:50:04.676034+00:00 app[web.1]: [2021-02-06 05:50:04 +0000] [9] [INFO] Booting worker with pid: 9
2021-02-06T05:50:04.703124+00:00 app[web.1]: [2021-02-06 05:50:04 +0000] [10] [INFO] Booting worker with pid: 10
2021-02-06T05:50:04.981300+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2021-02-06T05:50:04.981337+00:00 app[web.1]: """)
2021-02-06T05:50:05.000000+00:00 app[api]: Build succeeded
2021-02-06T05:50:05.086614+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2021-02-06T05:50:05.086615+00:00 app[web.1]: """)
2021-02-06T05:50:06.397214+00:00 heroku[web.1]: State changed from starting to up
2021-02-06T05:50:08.667840+00:00 app[web.1]: Not Found: /
2021-02-06T05:50:08.667985+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=38245610-72e8-43ab-a8df-a4957a487d1e fwd="74.101.138.195" dyno=web.1 connect=0ms service=125ms status=404 bytes=2400 protocol=https
2021-02-06T05:50:08.668610+00:00 app[web.1]: 10.182.117.232 - - [06/Feb/2021:05:50:08 +0000] "GET / HTTP/1.1" 404 2160 "https://dashboard.heroku.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:51:42.000000+00:00 app[api]: Build started by user myemail@gmail.com
2021-02-06T05:52:46.415468+00:00 app[api]: Deploy 4dc24524 by user myemail@gmail.com
2021-02-06T05:52:46.415468+00:00 app[api]: Release v51 created by user myemail@gmail.com
2021-02-06T05:52:46.627426+00:00 heroku[web.1]: Restarting
2021-02-06T05:52:46.643392+00:00 heroku[web.1]: State changed from up to starting
2021-02-06T05:52:47.560103+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-02-06T05:52:47.651176+00:00 app[web.1]: [2021-02-06 05:52:47 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-02-06T05:52:47.651188+00:00 app[web.1]: [2021-02-06 05:52:47 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-02-06T05:52:47.655456+00:00 app[web.1]: [2021-02-06 05:52:47 +0000] [4] [INFO] Handling signal: term
2021-02-06T05:52:47.756234+00:00 app[web.1]: [2021-02-06 05:52:47 +0000] [4] [INFO] Shutting down: Master
2021-02-06T05:52:47.837959+00:00 heroku[web.1]: Process exited with status 0
2021-02-06T05:52:58.498821+00:00 heroku[web.1]: Starting process with command `gunicorn myquiz.wsgi --log-file -`
2021-02-06T05:52:59.000000+00:00 app[api]: Build succeeded
2021-02-06T05:53:01.726865+00:00 app[web.1]: [2021-02-06 05:53:01 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-02-06T05:53:01.728247+00:00 app[web.1]: [2021-02-06 05:53:01 +0000] [4] [INFO] Listening at: http://0.0.0.0:4937 (4)
2021-02-06T05:53:01.728526+00:00 app[web.1]: [2021-02-06 05:53:01 +0000] [4] [INFO] Using worker: sync
2021-02-06T05:53:01.735683+00:00 app[web.1]: [2021-02-06 05:53:01 +0000] [9] [INFO] Booting worker with pid: 9
2021-02-06T05:53:01.777357+00:00 app[web.1]: [2021-02-06 05:53:01 +0000] [10] [INFO] Booting worker with pid: 10
2021-02-06T05:53:02.387750+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2021-02-06T05:53:02.387775+00:00 app[web.1]: """)
2021-02-06T05:53:02.536880+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2021-02-06T05:53:02.536883+00:00 app[web.1]: """)
2021-02-06T05:53:03.181646+00:00 heroku[web.1]: State changed from starting to up
2021-02-06T05:53:04.387317+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=a4297642-b4d0-45de-babf-2a9c51241934 fwd="74.101.138.195" dyno=web.1 connect=1ms service=259ms status=404 bytes=418 protocol=https
2021-02-06T05:53:04.389696+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:53:04 +0000] "GET / HTTP/1.1" 404 179 "https://dashboard.heroku.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:53:22.042667+00:00 heroku[router]: at=info method=GET path="/admin" host=myquiz-20192020.herokuapp.com request_id=f321097c-5ffc-4e70-a7b7-46a65c544a3c fwd="74.101.138.195" dyno=web.1 connect=1ms service=4ms status=301 bytes=256 protocol=https
2021-02-06T05:53:22.043383+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:53:22 +0000] "GET /admin HTTP/1.1" 301 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:53:22.111918+00:00 heroku[router]: at=info method=GET path="/admin/" host=myquiz-20192020.herokuapp.com request_id=6e155cc9-6fb6-4453-aeef-5d48af9d49b8 fwd="74.101.138.195" dyno=web.1 connect=1ms service=46ms status=302 bytes=412 protocol=https
2021-02-06T05:53:22.112587+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:53:22 +0000] "GET /admin/ HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:53:22.251424+00:00 heroku[router]: at=info method=GET path="/admin/login/?next=/admin/" host=myquiz-20192020.herokuapp.com request_id=54b20793-bb90-4104-ad3f-67c7f56bdab9 fwd="74.101.138.195" dyno=web.1 connect=1ms service=112ms status=500 bytes=410 protocol=https
2021-02-06T05:53:22.251635+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:53:22 +0000] "GET /admin/login/?next=/admin/ HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:53:30.755350+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=ab0e2d59-10dd-4fd3-a26a-f68ecf7029ae fwd="74.101.138.195" dyno=web.1 connect=1ms service=249ms status=404 bytes=418 protocol=https
2021-02-06T05:53:30.755735+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:53:30 +0000] "GET / HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:54:30.547441+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=3818e9f2-d03b-48f5-99f8-1b5d38b134cf fwd="74.101.138.195" dyno=web.1 connect=1ms service=6ms status=404 bytes=418 protocol=https
2021-02-06T05:54:30.548120+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:54:30 +0000] "GET / HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:54:32.793597+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=c0690601-864c-4509-9f89-b116491a0b29 fwd="74.101.138.195" dyno=web.1 connect=2ms service=5ms status=404 bytes=418 protocol=https
2021-02-06T05:54:32.794811+00:00 app[web.1]: 10.41.173.187 - - [06/Feb/2021:05:54:32 +0000] "GET / HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T05:57:58.831607+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=b8c546fb-b2bb-4058-b291-008716372822 fwd="74.101.138.195" dyno=web.1 connect=1ms service=3ms status=404 bytes=418 protocol=https
2021-02-06T05:57:58.831767+00:00 app[web.1]: 10.69.237.10 - - [06/Feb/2021:05:57:58 +0000] "GET / HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T06:00:09.000000+00:00 app[api]: Build started by user myemail@gmail.com
2021-02-06T06:01:11.742350+00:00 app[api]: Release v52 created by user myemail@gmail.com
2021-02-06T06:01:11.742350+00:00 app[api]: Deploy 097500b2 by user myemail@gmail.com
2021-02-06T06:01:11.962589+00:00 heroku[web.1]: Restarting
2021-02-06T06:01:11.989798+00:00 heroku[web.1]: State changed from up to starting
2021-02-06T06:01:13.059167+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-02-06T06:01:13.115692+00:00 app[web.1]: [2021-02-06 06:01:13 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-02-06T06:01:13.115706+00:00 app[web.1]: [2021-02-06 06:01:13 +0000] [4] [INFO] Handling signal: term
2021-02-06T06:01:13.117113+00:00 app[web.1]: [2021-02-06 06:01:13 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-02-06T06:01:13.316634+00:00 app[web.1]: [2021-02-06 06:01:13 +0000] [4] [INFO] Shutting down: Master
2021-02-06T06:01:13.393689+00:00 heroku[web.1]: Process exited with status 0
2021-02-06T06:01:19.035782+00:00 heroku[web.1]: Starting process with command `gunicorn myquiz.wsgi --log-file -`
2021-02-06T06:01:21.013399+00:00 app[web.1]: [2021-02-06 06:01:21 +0000] [4] [INFO] Starting gunicorn 20.0.4
2021-02-06T06:01:21.013943+00:00 app[web.1]: [2021-02-06 06:01:21 +0000] [4] [INFO] Listening at: http://0.0.0.0:10487 (4)
2021-02-06T06:01:21.014032+00:00 app[web.1]: [2021-02-06 06:01:21 +0000] [4] [INFO] Using worker: sync
2021-02-06T06:01:21.017760+00:00 app[web.1]: [2021-02-06 06:01:21 +0000] [9] [INFO] Booting worker with pid: 9
2021-02-06T06:01:21.047688+00:00 app[web.1]: [2021-02-06 06:01:21 +0000] [10] [INFO] Booting worker with pid: 10
2021-02-06T06:01:21.306613+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2021-02-06T06:01:21.306675+00:00 app[web.1]: """)
2021-02-06T06:01:21.328042+00:00 heroku[web.1]: State changed from starting to up
2021-02-06T06:01:21.367731+00:00 app[web.1]: /app/.heroku/python/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
2021-02-06T06:01:21.367733+00:00 app[web.1]: """)
2021-02-06T06:01:24.000000+00:00 app[api]: Build succeeded
2021-02-06T06:02:08.151715+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=fbee2c20-a1aa-4cf1-af50-6d4dbec7d81a fwd="74.101.138.195" dyno=web.1 connect=0ms service=118ms status=404 bytes=418 protocol=https
2021-02-06T06:02:08.152268+00:00 app[web.1]: 10.13.235.87 - - [06/Feb/2021:06:02:08 +0000] "GET / HTTP/1.1" 404 179 "https://dashboard.heroku.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T06:04:12.490929+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=d92d7123-c7f1-40da-8480-af4c574e2507 fwd="74.101.138.195" dyno=web.1 connect=1ms service=119ms status=404 bytes=418 protocol=https
2021-02-06T06:04:12.490572+00:00 app[web.1]: 10.35.250.120 - - [06/Feb/2021:06:04:12 +0000] "GET / HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T06:04:13.392300+00:00 heroku[router]: at=info method=GET path="/" host=myquiz-20192020.herokuapp.com request_id=e8bd1876-cf0f-4da7-b669-f5610aaa9600 fwd="74.101.138.195" dyno=web.1 connect=1ms service=3ms status=404 bytes=418 protocol=https
2021-02-06T06:04:13.386873+00:00 app[web.1]: 10.35.250.120 - - [06/Feb/2021:06:04:13 +0000] "GET / HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
2021-02-06T06:38:43.842393+00:00 heroku[web.1]: Idling
2021-02-06T06:38:43.846084+00:00 heroku[web.1]: State changed from up to down
2021-02-06T06:38:44.971060+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-02-06T06:38:45.031279+00:00 app[web.1]: [2021-02-06 06:38:45 +0000] [9] [INFO] Worker exiting (pid: 9)
2021-02-06T06:38:45.033378+00:00 app[web.1]: [2021-02-06 06:38:45 +0000] [10] [INFO] Worker exiting (pid: 10)
2021-02-06T06:38:45.062285+00:00 app[web.1]: [2021-02-06 06:38:45 +0000] [4] [INFO] Handling signal: term
2021-02-06T06:38:45.166985+00:00 app[web.1]: [2021-02-06 06:38:45 +0000] [4] [INFO] Shutting down: Master
2021-02-06T06:38:45.273200+00:00 heroku[web.1]: Process exited with status 0
原帖:
我的应用程序在 Django 本地服务器上运行良好。它也成功部署到 Heroku。但是当我去网站时,它说应用程序错误。
我看到一堆 H10 和 H14 错误代码。我尝试在没有初始空间的情况下更新 Procfile。我试过删除并重新添加 requirements.txt 文件。也许它与静态文件有关?一个SO解决方案说从requirements.txt文件中删除一堆你不需要的东西 - 因为这对他们有用。我只是不知道要删除哪些。
我无法添加我的 Heroku 日志 --tail - SO 认为将其识别为垃圾邮件。需要的话我可以email给你。请参阅以下内容:
答案 0 :(得分:0)
python manage.py collectstatic
我的静态文件都没有通过。这就是我必须跑的,太傻了。我确定我以前试过这个,但由于某种原因它现在有效。感谢您的所有帮助@DjangoDev1