Django auf Amazon Web Service (AWS)

Ich habe diese Tutorials gelesen:https: //realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk undhttp: //docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.htm

Ich verwende Django 1.8.2 und es scheint, dass das amazonische Dokument etwas veraltet ist (sie haben immer noch django-admin.py anstelle von django-admin verwendet), und einige Teile davon funktionieren nicht (wenn etwas nicht funktioniert, Ich greife auf den Realpython-Link 1 zurück.

Also, ich habe alles zum Laufen gebracht, außer dass meine Admin-Seite die statischen Dateien nicht lädt. Die CSS-Datei wird also nicht geladen.

Dies ist meine settings.py:

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

Ich habe auch versucht zu verwenden:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, 'static'). 

aber es funktioniert immer noch nicht.

dies ist meine eb config Datei:

container_commands:
  01_migrate:
    command: "source /opt/python/run/venv/bin/activate && python papp/manage.py migrate --noinput"
    leader_only: true
  02_createsuperuser:
    command: "source /opt/python/run/venv/bin/activate && python papp/manage.py createsu"
    leader_only: true
  03_collectstatic:
    command: "source /opt/python/run/venv/bin/activate && python papp/manage.py collectstatic --noinput"

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

Ich habe den Befehl eb deploy verwendet, nachdem ich die Änderungen vorgenommen habe.

Gibt es zusätzliche Schritte, die ich tun muss? Ich habe hier gelesen:Default Django 1.5 Admin-CSS funktioniert nicht dass ich den Alias ändern muss, aber es ist für Apache.

Ich lese auch aus Django Doc-Dateien wiehttps: //docs.djangoproject.com/de/1.8/howto/static-files aber ich bin mir nicht sicher, was ich in STATIC_ROOT for AWS einfügen soll

Jede Hilfe wird sehr geschätzt. Vielen Dan

Antworten auf die Frage(4)

Ihre Antwort auf die Frage