質問編集履歴

2

情報の追加

2017/12/20 14:03

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -38,66 +38,44 @@
38
38
 
39
39
 
40
40
 
41
- 回答をもらった結果
41
+ 回答をもらった結果bootflatへのパスを確認しましたが、404エラーが出ました。
42
42
 
43
- 設定を見直し、
43
+ ディレクトリ構成は以下のようになっています。
44
44
 
45
45
  ```ここに言語を入力
46
46
 
47
+ -PythonServer
48
+
49
+ -PythonServer
50
+
51
+ -logic
52
+
53
+ -templates
54
+
55
+ -xxx.html
56
+
47
- python manage.py collectstatic
57
+ -boolflat.github.io
58
+
59
+ -bower_components
48
60
 
49
61
  ```
50
-
51
- を実行すると、
52
-
53
- ```ここに言語を入力
54
-
55
- You have requested to collect static files at the destination
56
-
57
- location as specified in your settings:
58
-
59
-
60
-
61
- /home/ubuntu/PythonServer/accounts/static
62
-
63
-
64
-
65
- This will overwrite existing files!
66
-
67
- Are you sure you want to do this?
68
-
69
-
70
-
71
- Type 'yes' to continue, or 'no' to cancel: yes
72
-
73
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-changelink.svg'
74
-
75
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-addlink.svg'
76
-
77
-
78
-
79
-                    ・
80
-
81
-                    ・
82
-
83
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/prettify-min.js'
84
-
85
- Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/ajax-form.js'
86
-
87
-
88
-
89
- 159 static files copied to '/home/ubuntu/PythonServer/accounts/static', 19 unmodified.
90
-
91
- ```
92
-
93
- と出て一見成功しているように見えました。しかし、またサーバーを起動しても同じようにデザインが崩れた状態が表示されました。
94
62
 
95
63
  settings.pyには
96
64
 
97
65
  ```ここに言語を入力
98
66
 
67
+ import os
68
+
69
+
70
+
71
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
72
+
99
- STATIC_ROOT = "/home/ubuntu/PythonServer/accounts/static"
73
+ STATIC_URL = '/static/'
74
+
75
+
76
+
77
+ STATICFILES_DIRS = [os.path.join(BASE_DIR,'bootflat.github.io'), ]
100
78
 
101
79
  ```
102
80
 
103
- Ubuntuのホームディレクトリから、PythonServerアプリケーションの中のaccountsアプリの中にあるstaticフォルダを指し示すディレクトリを書きました。なぜpython manage.py collectstaticコマンドが成功しているのにbootstrapなどのデザインが適用されないのでしょうか?
81
+ と書きました。

1

情報の修正

2017/12/20 14:03

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,69 @@
35
35
  ローカルで動かしていた時はbootstrapがちゃんと適用されデザインがついていたのでなぜこうなってしまうのかわかりません。ディレクトリ構造も変更していません。
36
36
 
37
37
  なぜこうなってしまい、どう直せば良いのでしょうか?
38
+
39
+
40
+
41
+ 回答をもらった結果
42
+
43
+ 設定を見直し、
44
+
45
+ ```ここに言語を入力
46
+
47
+ python manage.py collectstatic
48
+
49
+ ```
50
+
51
+ を実行すると、
52
+
53
+ ```ここに言語を入力
54
+
55
+ You have requested to collect static files at the destination
56
+
57
+ location as specified in your settings:
58
+
59
+
60
+
61
+ /home/ubuntu/PythonServer/accounts/static
62
+
63
+
64
+
65
+ This will overwrite existing files!
66
+
67
+ Are you sure you want to do this?
68
+
69
+
70
+
71
+ Type 'yes' to continue, or 'no' to cancel: yes
72
+
73
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-changelink.svg'
74
+
75
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/django/contrib/admin/static/admin/img/icon-addlink.svg'
76
+
77
+
78
+
79
+                    ・
80
+
81
+                    ・
82
+
83
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/prettify-min.js'
84
+
85
+ Copying '/home/ubuntu/anaconda3/lib/python3.5/site-packages/rest_framework/static/rest_framework/js/ajax-form.js'
86
+
87
+
88
+
89
+ 159 static files copied to '/home/ubuntu/PythonServer/accounts/static', 19 unmodified.
90
+
91
+ ```
92
+
93
+ と出て一見成功しているように見えました。しかし、またサーバーを起動しても同じようにデザインが崩れた状態が表示されました。
94
+
95
+ settings.pyには
96
+
97
+ ```ここに言語を入力
98
+
99
+ STATIC_ROOT = "/home/ubuntu/PythonServer/accounts/static"
100
+
101
+ ```
102
+
103
+ とUbuntuのホームディレクトリから、PythonServerアプリケーションの中のaccountsアプリの中にあるstaticフォルダを指し示すディレクトリを書きました。なぜpython manage.py collectstaticコマンドが成功しているのにbootstrapなどのデザインが適用されないのでしょうか?