Django 休息框架 Heroku 应用程序错误
Django rest framework Heroku Application Error
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in Pipfile.lock
-----> Requirements file has been changed, clearing cached dependencies
cp: cannot stat '/tmp/build_eaebc38f/requirements.txt': No such file or directory
-----> Installing python-3.10.2
-----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
-----> Installing dependencies with Pipenv 2020.11.15
Installing dependencies from Pipfile.lock (86a10d)...
Ignoring tzdata: markers 'sys_platform == "win32"' don't match your environment
-----> Installing SQLite3
-----> $ python manage.py collectstatic --noinput
System check identified some issues:
WARNINGS:
?: (staticfiles.W004) The directory '/tmp/build_eaebc38f/static' in the STATICFILES_DIRS setting does not exist.
161 static files copied to '/tmp/build_eaebc38f/staticfiles', 414 post-processed.
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 98.7M
-----> Launching...
Released v11
https://vicsites.herokuapp.com/ deployed to Heroku
这是我的 heroku 部署日志,它仍然显示应用程序错误
这是我的 Procfile
web: gunicorn vicsite.wsgi --log-file -
我在上述日志中发现的错误是:
?: (staticfiles.W004) STATICFILES_DIRS 设置中的目录“/tmp/build_eaebc38f/static”不存在。
161 个静态文件已复制到“/tmp/build_eaebc38f/staticfiles”,已处理 414 个 post。
'sys_platform == "win32" 与您的环境不匹配
我的项目目录
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 3/11/2022 5:58 AM .vscode
d---- 3/12/2022 9:50 PM accounts
d---- 3/10/2022 6:43 AM investments
d---- 3/13/2022 9:06 PM site_server
d---- 3/14/2022 4:22 AM static
d---- 3/14/2022 4:25 AM staticfiles
d---- 3/10/2022 7:58 PM transactions
-a--- 3/13/2022 2:37 PM 23 .gitignore
-a--- 3/13/2022 2:43 PM 303104 db.sqlite3
-a--- 3/5/2022 2:55 PM 689 manage.py
-a--- 3/14/2022 4:58 AM 345 Pipfile
-a--- 3/14/2022 5:45 AM 29742 Pipfile.lock
-a--- 3/14/2022 11:10 AM 39 Procfile
-a--- 3/5/2022 2:43 PM 9 README.md
问题出在我的 Procfile 上。
我传递的是文件夹名称 (vicsite) 而不是项目名称 (site_server):
web: gunicorn vicsite.wsgi --log-file -
所以正确的代码是:
web: gunicorn site_server.wsgi --log-file -
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in Pipfile.lock
-----> Requirements file has been changed, clearing cached dependencies
cp: cannot stat '/tmp/build_eaebc38f/requirements.txt': No such file or directory
-----> Installing python-3.10.2
-----> Installing pip 21.3.1, setuptools 57.5.0 and wheel 0.37.0
-----> Installing dependencies with Pipenv 2020.11.15
Installing dependencies from Pipfile.lock (86a10d)...
Ignoring tzdata: markers 'sys_platform == "win32"' don't match your environment
-----> Installing SQLite3
-----> $ python manage.py collectstatic --noinput
System check identified some issues:
WARNINGS:
?: (staticfiles.W004) The directory '/tmp/build_eaebc38f/static' in the STATICFILES_DIRS setting does not exist.
161 static files copied to '/tmp/build_eaebc38f/staticfiles', 414 post-processed.
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 98.7M
-----> Launching...
Released v11
https://vicsites.herokuapp.com/ deployed to Heroku
这是我的 heroku 部署日志,它仍然显示应用程序错误
这是我的 Procfile
web: gunicorn vicsite.wsgi --log-file -
我在上述日志中发现的错误是:
?: (staticfiles.W004) STATICFILES_DIRS 设置中的目录“/tmp/build_eaebc38f/static”不存在。 161 个静态文件已复制到“/tmp/build_eaebc38f/staticfiles”,已处理 414 个 post。 'sys_platform == "win32" 与您的环境不匹配
我的项目目录
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 3/11/2022 5:58 AM .vscode
d---- 3/12/2022 9:50 PM accounts
d---- 3/10/2022 6:43 AM investments
d---- 3/13/2022 9:06 PM site_server
d---- 3/14/2022 4:22 AM static
d---- 3/14/2022 4:25 AM staticfiles
d---- 3/10/2022 7:58 PM transactions
-a--- 3/13/2022 2:37 PM 23 .gitignore
-a--- 3/13/2022 2:43 PM 303104 db.sqlite3
-a--- 3/5/2022 2:55 PM 689 manage.py
-a--- 3/14/2022 4:58 AM 345 Pipfile
-a--- 3/14/2022 5:45 AM 29742 Pipfile.lock
-a--- 3/14/2022 11:10 AM 39 Procfile
-a--- 3/5/2022 2:43 PM 9 README.md
问题出在我的 Procfile 上。 我传递的是文件夹名称 (vicsite) 而不是项目名称 (site_server):
web: gunicorn vicsite.wsgi --log-file -
所以正确的代码是:
web: gunicorn site_server.wsgi --log-file -