[Python] AWS Elastic Beanstalk can not find static files for Django App

Discussão em 'Python' iniciado por Stack, Setembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    I am having a little trouble setting up the static folders on elastic beanstalk for a django app I created. I manged to get the app to run without any of the css/js/etc. My file structure is:

    |.ebextensions
    | --django.config
    |.elasticbeanstalk
    | --config.yml
    |django_app
    | --core
    | --blog
    | --other apps..
    |config
    | --settings
    | --base.py
    | --local.py
    | --production.py
    | --asgi.py
    | --urls.py
    | --wsgi.py
    |static
    | --blog
    | --css/js/etc
    | --other apps
    |manage.py
    |requirements.txt
    |secrets.json


    in my django.config I have it set up like so:

    option_settings:
    aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: config.settings.production
    aws:elasticbeanstalk:container:python:
    WSGIPath: config.wsgi:application
    NumProcesses: 3
    NumThreads: 20


    and for my static settings in base.py (production/local.py do import base.py):

    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/3.0/howto/static-files/
    STATIC_URL = '/static/'
    STATIC_ROOT = "static"


    I had a similar problem with flask but it didn't give me this much trouble. I have tried to follow some of the solutions that are on here but nothing has worked just yet or I am misinterpreting something. Any help is appreciated!

    Continue reading...

Compartilhe esta Página