2017-12-19 9 views
1

부트 스트랩이 내 장고 앱으로 설정되지 않았습니다. Google 콘솔에서 리소스를로드하지 못했습니다 : 서버가 404 (찾을 수 없음) bootflat.min.css 오류로 응답했습니다. 나는 부트 스트랩이 장고 앱으로 설정되지 않음

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 
    } 
} 

내가 부트 스트랩이 내 장고 app.I 실행 명령 파이썬 manage.py의 collectstatic하지만 오류로 설정하지 않는 이유를 모르는

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'), ] 

PythonServer_nginx.conf

에 settings.py에 썼다 어떻게해야합니까? 내가 써야 할게 뭐야?

+0

왜 'STATICFILES_DIRS'에서 dir으로 설정 될 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'은 일치 할 필요가 없습니다. 첫 번째는 두 번째 옆에 다른 dir을 추가하기위한 것입니다. –