Heroku上的Python应用程序部署导致应用程序错误H10

2024-04-29 04:58:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将我的Python项目部署到Heroku,我遵循了Heroku的教程,但是仍然得到一个应用程序错误。在

  (ISproject) Hessas-MBP-2:ISproject hessaaljeri$ git push heroku master
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 985 bytes | 0 bytes/s, done.
Total 9 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote:       /app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/b in/steps/python: line 7: [: too many arguments
 remote: -----> Installing requirements with pip
 remote: 
 remote: -----> $ python manage.py collectstatic --noinput
 remote:        180 static files copied to    '/tmp/build_eb1f0e2e350e841c604cef9887a7c8c2/static'.
 remote: 
 remote: -----> Discovering process types
 remote:        Procfile declares types -> web
 remote: 
 remote: -----> Compressing...
 remote:        Done: 74.8M
 remote: -----> Launching...
 remote:        Released v6
 remote:        https://charitycba.herokuapp.com/ deployed to Heroku
 remote: 
 remote: Verifying deploy.... done.
 To https://git.heroku.com/charitycba.git
 2890bc6..116d04a  master -> master
 (ISproject) Hessas-MBP-2:ISproject hessaaljeri$ heroku run ./manage.py   migrate
 Running ./manage.py migrate on ⬢ charitycba... up, run.7297 (Free)
 Operations to perform:
 Synchronize unmigrated apps: crispy_forms, messages, datetimewidget,  staticfiles, geoposition
 Apply all migrations: auth, sessions, admin, registration, contenttypes, app, sites
 Synchronizing apps without migrations:
 Creating tables...
 Running deferred SQL...
 Installing custom SQL...
 Running migrations:
 No migrations to apply.

在那之后,当我打开它的时候,我看到了这个:

Image

Heroku日志文件:

^{pr2}$

我错过了什么?在


Tags: topygitmasterappherokuobjectsmanage
1条回答
网友
1楼 · 发布于 2024-04-29 04:58:51

我如何修复它:

在我的设置.py公司名称:

STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
   os.path.join(PROJECT_ROOT, '../app/static'),
)

'../app/static'我告诉它进入一个目录,进入我的应用程序,其中有我的静态文件夹。

在我的程序文件里

^{pr2}$

我替换了gettingstarted.wsgi通过项目.wsgi 因为wsgi.py在我的项目文件夹中。

相关问题 更多 >