0

I am trying to use AWS Beanstalk CLI to deploy a Django web application using the command line but I am not able to serve properly the static files. This is my configuration file (.elasticbeanstalk/config.yml):

branch-defaults:
  aws-cli:
    environment: gather-api-environment
    group_suffix: null
environment-defaults:
  gather-api-environment:
    branch: null
    repository: null
global:
  application_name: gather-api-application
  branch: null
  default_ec2_keyname: beanstalk
  default_platform: Python 3.8 running on 64bit Amazon Linux 2
  default_region: eu-central-1
  include_git_submodules: true
  instance_profile: null
  platform_name: null
  platform_version: null
  profile: DataArchitect
  repository: null
  sc: git
  workspace_type: Application
option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: cdm_api.wsgi:application
  aws:elasticbeanstalk:environment:proxy:staticfiles:
    /static: /static/
packages:
  yum:
    postgresql-devel: []

However, when I load this folder as a zip file using the AWS UI console ("Upload and deploy button"), it works. Here is my .ebextensions/django.config file:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: cdm_api.wsgi:application
  aws:elasticbeanstalk:environment:proxy:staticfiles:
    /static: /static/

Any suggestions? Let me know if more information is needed. Thanks in advance!

Fernando C.
  • 201
  • 1
  • 11

1 Answers1

0

I found the solution here:

eb deploy does not update the code

Basically, when you run eb deploy on a git repository, it only deploys the latest committed version of the repository. There is a partial workaround to deploy uncommitted changes, you need to stage the changed files and then run eb deploy with --staged flag.

Fernando C.
  • 201
  • 1
  • 11