私はherokuにプロジェクト(myapp)を持っていますが、静的ファイルを正しく取得することができません。私はこれに続いていたblog post。Heroku - Djangoアプリケーションの静的ファイルの処理
は私のProcfile
は、次のようになります。
web: python myapp/manage.py collectstatic --noinput; bin/gunicorn_django --workers=4 --bind=0.0.0.0:$PORT myapp/settings.py
settings.py
:
...
STATIC_ROOT = os.path.join(PROJECT_PATH, 'staticfiles')
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATICFILES_DIRS = (
# I have the static folder inside my app and not inside the project
os.path.join(PROJECT_PATH, 'cesar/static'),
)
...
再起動heroku restart
これを使って何heroku logs
示しています
...
Copying ...
114 static files copied to '/app/myapp/staticfiles'.
...
をしかし、私はheroku run ls -l myapp/
Iを行うとき
-rw------- 1 u5605 5605 0 Jan 28 16:53 __init__.py
drwx------ 4 u5605 5605 4096 Jan 28 16:53 cesar
-rw------- 1 u5605 5605 503 Jan 28 16:53 manage.py
-rw------- 1 u5605 5605 6292 Jan 28 16:53 settings.py
drwx------ 2 u5605 5605 4096 Jan 28 16:53 templates
-rw------- 1 u5605 5605 257 Jan 28 16:53 urls.py
-rw------- 1 u5605 5605 286 Jan 28 16:53 views.py
は、私が何をしないか、間違っています:staticfiles
フォルダを見ることができませんか?
私は最近HerokuアプリからS3に静的ファイルを提供することについて精巧な説明を書きました。http://balzerg.blogspot.co.il/2012/09/staticfiles-on -heroku-with-django.html – idanzalz