Djangoでアプリを開発しています。
python manage.py collectstaticを実行すると、下記のようにPermissionErrorが出ます。
$ python manage.py collectstatic Copying '/home/username/myproject/testproject/lib/python3.5/site-packages/jet/static/admin/css/forms.css' Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **cmd_options) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/core/management/base.py", line 335, in execute output = self.handle(*args, **options) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle collected = self.collect() File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect handler(path, prefixed_path, storage) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 354, in copy_file self.storage.save(prefixed_path, source_file) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/core/files/storage.py", line 49, in save return self._save(name, content) File "/home/username/myproject/testproject/lib/python3.5/site-packages/django/core/files/storage.py", line 236, in _save os.makedirs(directory) File "/usr/lib/python3.5/os.py", line 231, in makedirs makedirs(head, mode, exist_ok) File "/usr/lib/python3.5/os.py", line 231, in makedirs makedirs(head, mode, exist_ok) File "/usr/lib/python3.5/os.py", line 231, in makedirs makedirs(head, mode, exist_ok) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/test'
パーミッションの問題だと思ったので、
https://qiita.com/xKxAxKx/items/f43d1bddbc4fb31013b1
を参考に、
$ sudo chmod o+x ~/myproject/testproject/
を実行し、ls -lを実行すると、
drwxrwxr-x 12 username username 4096 May 18 21:15 testproject
となりました。
そのため、実行権限は、与えられていると思います。
なお、設定は下記のようになっています。
python
1# settings.py 2BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 3STATIC_URL = '/static/' 4MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 5MEDIA_URL = '/media/' 6STATIC_ROOT = os.path.join(BASE_DIR, "/archi/static/")
<!-- etc/nginx/site-enabled/default --> location /static/{ alias /home/username/myproject/testproject/test/static/; access_log /dev/null; }
どこに問題がありそうか、お気づきの方、見えないでしょうか。
よろしくお願い致しますm(__)m
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/07/17 07:44