0
`python manage.py collectstatic Traceback (most recent call last):   File "manage.py", line 21, in <module>
    main()   File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
    collected = self.collect()   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 104, in collect
    for path, storage in finder.list(self.ignore_patterns):   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/contrib/staticfiles/finders.py", line 130, in list
    for path in utils.get_files(storage, ignore_patterns):   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/contrib/staticfiles/utils.py", line 23, in get_files
    directories, files = storage.listdir(location)   File "/home/jet/venvfordjango/lib/python3.7/site-packages/django/core/files/storage.py", line 316, in listdir
    for entry in os.scandir(path): FileNotFoundError: [Errno 2] No such file or directory: '/home/jet/myapp/static'`

私のsettings.pyは次のようになります

    # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))  
    
    .......
    
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.9/howto/static-files/
    STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
    STATIC_URL = '/static/'
    
    # Extra places for collectstatic to find static files.
    STATICFILES_DIRS = (
        os.path.join(BASE_DIR, 'static'),
    )
    ........

MEDIA_ROOT= os.path.join(BASE_DIR, 'media/')
MEDIA_URL= "/media/"

では、どこに問題があるのでしょうか。リクエストに応じてリソースを追加する準備ができました よろしくお願いします

4

1 に答える 1