質問するログイン新規登録

質問編集履歴

2

情報の追加

2017/12/20 14:03

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -18,35 +18,24 @@
18
18
  ローカルで動かしていた時はbootstrapがちゃんと適用されデザインがついていたのでなぜこうなってしまうのかわかりません。ディレクトリ構造も変更していません。
19
19
  なぜこうなってしまい、どう直せば良いのでしょうか?
20
20
 
21
- 回答をもらった結果
21
+ 回答をもらった結果bootflatへのパスを確認しましたが、404エラーが出ました。
22
- 設定を見直し、
22
+ ディレクトリ構成は以下のようになっています。
23
23
  ```ここに言語を入力
24
+ -PythonServer
25
+ -PythonServer
26
+ -logic
27
+ -templates
28
+ -xxx.html
24
- python manage.py collectstatic
29
+ -boolflat.github.io
30
+ -bower_components
25
31
  ```
26
- を実行すると、
32
+ settings.pyには
27
33
  ```ここに言語を入力
28
- You have requested to collect static files at the destination
29
- location as specified in your settings:
34
+ import os
30
35
 
36
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
31
- /home/ubuntu/PythonServer/accounts/static
37
+ STATIC_URL = '/static/'
32
38
 
33
- This will overwrite existing files!
34
- Are you sure you want to do this?
35
-
36
- Type 'yes' to continue, or 'no' to cancel: yes
39
+ STATICFILES_DIRS = [os.path.join(BASE_DIR,'bootflat.github.io'), ]
37
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-changelink.svg'
38
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-addlink.svg'
39
-
40
-                    ・
41
-                    ・
42
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/prettify-min.js'
43
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/ajax-form.js'
44
-
45
- 159 static files copied to '/home/ubuntu/PythonServer/accounts/static', 19 unmodified.
46
40
  ```
47
- と出て一見成功しているように見えました。しかし、またサーバーを起動しても同じようにデザインが崩れた状態が表示されました。
48
- settings.pyには
49
- ```ここに言語を入力
41
+ と書きました。
50
- STATIC_ROOT = "/home/ubuntu/PythonServer/accounts/static"
51
- ```
52
- とUbuntuのホームディレクトリから、PythonServerアプリケーションの中のaccountsアプリの中にあるstaticフォルダを指し示すディレクトリを書きました。なぜpython manage.py collectstaticコマンドが成功しているのにbootstrapなどのデザインが適用されないのでしょうか?

1

情報の修正

2017/12/20 14:03

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -16,4 +16,37 @@
16
16
  ```
17
17
  とブラウザ上でアクセスするとGoogle Chrome のConsoleでbootstrap.min.jsなどがないbootstrapが適用されないWEBサイトが表示されます。
18
18
  ローカルで動かしていた時はbootstrapがちゃんと適用されデザインがついていたのでなぜこうなってしまうのかわかりません。ディレクトリ構造も変更していません。
19
- なぜこうなってしまい、どう直せば良いのでしょうか?
19
+ なぜこうなってしまい、どう直せば良いのでしょうか?
20
+
21
+ 回答をもらった結果
22
+ 設定を見直し、
23
+ ```ここに言語を入力
24
+ python manage.py collectstatic
25
+ ```
26
+ を実行すると、
27
+ ```ここに言語を入力
28
+ You have requested to collect static files at the destination
29
+ location as specified in your settings:
30
+
31
+ /home/ubuntu/PythonServer/accounts/static
32
+
33
+ This will overwrite existing files!
34
+ Are you sure you want to do this?
35
+
36
+ Type 'yes' to continue, or 'no' to cancel: yes
37
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-changelink.svg'
38
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-addlink.svg'
39
+
40
+                    ・
41
+                    ・
42
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/prettify-min.js'
43
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/ajax-form.js'
44
+
45
+ 159 static files copied to '/home/ubuntu/PythonServer/accounts/static', 19 unmodified.
46
+ ```
47
+ と出て一見成功しているように見えました。しかし、またサーバーを起動しても同じようにデザインが崩れた状態が表示されました。
48
+ settings.pyには
49
+ ```ここに言語を入力
50
+ STATIC_ROOT = "/home/ubuntu/PythonServer/accounts/static"
51
+ ```
52
+ とUbuntuのホームディレクトリから、PythonServerアプリケーションの中のaccountsアプリの中にあるstaticフォルダを指し示すディレクトリを書きました。なぜpython manage.py collectstaticコマンドが成功しているのにbootstrapなどのデザインが適用されないのでしょうか?