R. Farahani
R. Farahani

Reputation: 13

Elastic Beanstalk does not load the Django admin static files

I have static files in a specific app in my project, and I add that route in my config file as my static route for EB, and as I do this EB doesn't load required CSS files for django admin page. My python.config looks like:
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: MyProject/wsgi.py
"aws:elasticbeanstalk:container:python:staticfiles":
/static/: "MyApp/static/"

And I get the following error:

Failed to load resource: the server responded with a status of 404 (Not Found) /static/admin/css/responsive.css:1

Upvotes: 1

Views: 1251

Answers (1)

souleymane DEMBELE
souleymane DEMBELE

Reputation: 406

To tell Django where to store static files, define STATIC_ROOT in settings.py:

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

And type the commande:

python manage.py collectstatic

Upvotes: 1

Related Questions