css在aws上的Django的管理页面中不起作用

2024-05-13 01:16:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我遵循了本教程:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-create-app

除了管理页面中的css外,一切正常

我已经试过了:

Default Django 1.5 admin css not working

Django on Amazon Web Service (AWS)

但是没有成功

我有以下配置:

folia_eb.config:
container_commands:
01_migrate:
command: "django-admin.py migrate"
leader_only: true
02_collectstatic:
command: "django-admin.py collectstatic --noinput"
leader_only: true

option_settings:
"aws:elasticbeanstalk:application:environment":
DJANGO_SETTINGS_MODULE: "folia_eb.settings"
PYTHONPATH: "/opt/python/current/app/folia_eb:$PYTHONPATH"
"aws:elasticbeanstalk:container:python":
WSGIPath: "folia_eb/folia_eb/wsgi.py"
"aws:elasticbeanstalk:container:python:staticfiles":
"/static/": "static/"

settings.py:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static/')

有人能帮我吗?在

提前谢谢


Tags: djangopyawsappsettingsadmincontainercreate
1条回答
网友
1楼 · 发布于 2024-05-13 01:16:16

我有相同的CSS文件找不到管理网站的问题,当以下情况:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html#python-django-create-app

对我有用的是:

.e扩展/django.config文件公司名称:

container_commands:
   01_collectstatic:
      command: "python manage.py collectstatic  noinput"
      leader_only: true

选项设置:

^{pr2}$

将以下行添加到ebdjango/设置.py公司名称:

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

然后部署eb

希望这有帮助

相关问题 更多 >