Issues Running Django App on Elastic Beanstalk

Hello,

I apologize if this topic isn’t relevant for this forum. I’m a pretty new developer, and I’ve created a pretty simple django application that I’m attempting to deploy using AWS Elastic Beanstalk for my portfolio. I’ve managed to get the home page of the application to load, however it seems that none of the static files are loading, as it has no style or images. I also receive a 500 error when trying to load any page requiring a database connection and finding json files associated with the required models.

I’ve tried a number of troubleshooting suggestions I’ve found to no avail.

My static_url & static_root

STATIC_URL = 'static/'
STATIC_ROOT = 'static'

My Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / os.environ.get('DB_NAME'),
    }
}

Any suggestions on troubleshooting ideas would be much appreciated.

Thank you!

hi,

I suppose you are using the wsgi version of EB, the thing is that you actually need to run two commands, collectstatic and migrate.
I think it pretty hard to do it in EB since the docs are no very helpfful for that.

I suggest you to use docker version of EB where you can run easily your commands or having more control

Hi Daniel,

Thanks for your response! I am using the WSGI version of EB, and you are right, I have those commands set to run in the config file the docs seem to say to place them, but the docs are quite unclear, and they are definitely not running.

I was not aware EB had a docker version, but I definitely will look into it as a better way to deploy my Django apps!