2017-12-19 24 views
1

ブートストラップがDjangoアプリに設定されていません.Googleコンソールで、リソースの読み込みに失敗しました:サーバが404のステータス(not found)で応答しましたbootflat.min.cssエラーが発生します。私は、ブートストラップは私のジャンゴapp.I実行コマンドのpython manage.py collectstaticが、エラーなしに設定されていない理由を私は知らない ブートストラップがDjangoアプリに設定されていません

server { 
    # the port your site will be served on 
    listen  8000; 
    # the domain name it will serve for 
    server_name MyServerIPAdress; # substitute your machine's IP address or FQDN 
    charset  utf-8; 

    # max upload size 
    client_max_body_size 75M; # adjust to taste 

    location /static { 
     alias /home/ubuntu/PythonServer/PythonServer/accounts/static; # your Django project's static files - amend as required 
    } 

    # Finally, send all non-media requests to the Django server. 
    location/{ 
     uwsgi_pass django; 
     include  /home/ubuntu/PythonServer/uwsgi_params; # the uwsgi_params file you installed 
    } 
} 

PythonServer_nginx.conf

にsettings.py

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
DEBUG =True 

STATIC_URL = '/static/' 

STATIC_ROOT = os.path.join(BASE_DIR, "static/") 

STATICFILES_DIRS = [os.path.join(BASE_DIR,'bootflat.github.io'), ] 

に書きました私はこれをどのように修正すべきですか?私はそれを何に書きますか?

+0

なぜあなたは 'STATICFILES_DIRS'にディレクトリとして設定されることになっているURLにURLを追加していますか? –

答えて

0

明らかに私の答えをテストする方法はありませんが、STATICFILES_DIRSSTATIC_ROOTは一致しません。 STATICFILES_DIRS[os.path.join(BASE_DIR,"/static/"),'https://bootflat.github.io']に変更すると動作する可能性があります。 os.path.joinのパブリックURLを持つローカルパスには意味をなさないので、私はそう提案しました。

+0

'STATICFILES_DIRS'と' STATIC_ROOT'は一致する必要はありません。最初のものは2番目のディレクトリの横に他のディレクトリを追加するためのものです。 –

関連する問題