Djangopipe理资产在弹性beanstalk上是不可用的

我在AWS上创build了一个基本的Python Django环境。 我的项目是由django-admin startproject michaelmalura 。 我用django-admin startapp blog添加了一个应用程序。

在我用eb deploy发布我的项目之后,前台的所有东西都可以正常工作。 但后端不显示任何样式。

settings.py

 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog' ] 

 STATIC_ROOT = os.path.join(BASE_DIR, "..", "static") STATIC_URL = '/static/' 

django.config

 container_commands: 01_migrate: command: "python manage.py migrate --noinput" leader_only: true 02_collectstatic: command: "python manage.py collectstatic --noinput" option_settings: "aws:elasticbeanstalk:container:python:environment": DJANGO_SETTINGS_MODULE: "michaelmalura.settings" aws:elasticbeanstalk:container:python: WSGIPath: "michaelmalura/wsgi.py" "aws:elasticbeanstalk:container:python:staticfiles": "/static/": "static/" 

pipe理员错误

Failed to load resource: the server responded with a status of 404 (Not Found) http://michaelmalura.eu-central-1.elasticbeanstalk.com/static/admin/css/base.css

我终于find了解决这个问题的方法。 我从STATIC_ROOT删除..

 STATIC_ROOT = os.path.join(BASE_DIR, 'static/') STATIC_URL = '/static/'