elastic beanstalk - Django Elasticbeanstalk: Cannot access static files when Debug = False -
my static files served no issue when debug = true. have read documentation on https://docs.djangoproject.com/en/1.8/howto/static-files/deployment/ still cannot work when debug = false. these settings (works fine when debug = true):
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) static_url = 'myapp/static/' static_root = os.path.join(os.path.dirname(base_dir),"myapp","static","static-only") staticfiles_dirs = ( os.path.join(os.path.dirname(base_dir),"myapp","static"), )
i have edited config file be:
container_commands: collectstatic: command: "myapp/manage.py collectstatic --noinput" option_settings: "aws:elasticbeanstalk:application:environment": django_settings_module: "myapp.settings" pythonpath: "/opt/python/current/app/myapp:$pythonpath" "aws:elasticbeanstalk:container:python": wsgipath: "myapp/myapp/wsgi.py" "aws:elasticbeanstalk:container:python:staticfiles": "/static/": "myapp/static/"
i have been banging head on time appreciated!
i don't have direct answer question, other ask why trying way. best practice move static files s3 or ideally, cloudfront (or non-aws solution).
use django-storages-redux (https://github.com/jschneier/django-storages) use static files s3 production. google 'django s3 static' , find several blogs explaining process. documentation here.
hope helps.
Comments
Post a Comment