diadia

興味があることをやってみる。自分のメモを残しておきます。

staticについて理解を深める

まず開発中の場合、django.views.static.serve() ビューを用いてstaticファイル、mediaファイルを配信するようだ。

https://docs.djangoproject.com/ja/2.1/howto/static-files/#serving-static-files-during-development https://docs.djangoproject.com/ja/2.1/howto/static-files/#serving-files-uploaded-by-a-user-during-development

collectstaticのこと

python manage.py collectstatic

このコマンドにより、各staticフォルダからSTATIC_ROOTのディレクトリにファイルがコピーされるようだ。

 

django.contrib.staticfilesのこと

https://docs.djangoproject.com/ja/2.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles

 

3つのコマンドがあるらしい

collectstatic

python manage.py collectstatic

findstatic

python manage.py findstatic css/base.css

runserver

django-admin runserver [addrport]