Я не могу понять, как обслуживать статические файлы с помощью AWS Elasticbeanstalk - PullRequest
0 голосов
/ 29 сентября 2019

Я работал над этим два дня подряд, и я не могу понять это.Буду признателен за любую помощь.

Я использую Python 3.6, работающий на 64-битной Amazon Linux / 2.7.7 из Elastic Beanstalk.

Это моя файловая структура:

- analytics
   -- (a bunch of files that I think are irrelevant here)
- db.sqlite3
- ecs_site
  -- __init__.py
  -- __pycache__
  -- settings.py
  -- static
     -- css
        -- (a bunch of files - important)
     -- fonts
        -- (a bunch of files - important)
     -- images
        -- (a bunch of files - important)
  -- templates
     -- (a bunch of files that I think are irrelevant here)
  -- urls.py
  -- wsgi.py
- manage.py
- pages
     -- (a bunch of files that I think are irrelevant here)
- requirements.txt

В файле settings.py вот что есть:

#STATIC_ROOT = os.path.dirname(__file__)

STATIC_ROOT = os.path.join(BASE_DIR, "ecs_site", "static")

#SITE_ROOT = os.path.dirname(os.path.realpath(__file__))

#STATICFILES_DIRS = [os.path.join(SITE_ROOT, 'static/')]

STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]

STATIC_URL = '/static/'

#STATICFILES_DIRS = [os.path.join(BASE_DIR, 'ecs_site/static/'), os.path.join(BASE_DIR, 'ecs_site/static/images/'), 
#os.path.join(BASE_DIR, 'ecs_site/static/fonts/'), os.path.join(BASE_DIR, 'ecs_site/static'), os.path.join(BASE_DIR, 'ecs_site/static/images'), 
#os.path.join(BASE_DIR, 'ecs_site/static/fonts')]

#STATICFILES_DIRS = [os.path.join(BASE_DIR, '/static/'), os.path.join(BASE_DIR, '/static/images/'), 
#os.path.join(BASE_DIR, '/static/fonts/'), os.path.join(BASE_DIR, '/static'), os.path.join(BASE_DIR, '/static/images'), 
#os.path.join(BASE_DIR, '/static/fonts')]

В файле конфигурации вот что у меня есть (setв консоли AWS EB):

enter image description here

enter image description here

...