'Required parameter name not set - Django + Amazon S3

I'm trying to setup Amazon S3 for my Django app and I keep getting told 'Required parameter name not set '. This error seems to happen when an image needs to be displayed. For example, it works fine on the homepage where there are no images. Really don't know where I have went wrong. I have following set up in my settings.py.

INSTALLED_APPS = [
    'projects',
    'users.apps.UsersConfig',
    'crispy_forms',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'storages',
]

#S3 BUCKET CONFIG

AWS_ACCESS_KEY_ID = 'acccess key'
AWS_SECRET_ACCESS_KEY = 'secret access key'
AWS_BUCKET_NAME = 'bucket name'


AWS_S3_FILE_OVERWRITE = False
AWS_DEFAULT_ACL = None
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

Full traceback

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/projects/createListing

Django Version: 2.2
Python Version: 3.7.3
Installed Applications:
['projects',
 'users.apps.UsersConfig',
 'crispy_forms',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'storages']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template C:\Users\Maksims\Desktop\CA4106-Cloud-Computing\test\src\personal_portfolio\templates\base.html, error at line 10
   Required parameter name not set
   1 : {% load static %}
   2 : <!doctype html>
   3 : <html lang="en">
   4 :   <head>
   5 :     <!-- Required meta tags -->
   6 :     <meta charset="utf-8">
   7 :     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
   8 : 
   9 :     <!-- Bootstrap CSS -->
   10 :     <link re l="stylesheet" href="https://stack path.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
   11 : 
   12 :     {% if title %}
   13 :       <title>Prestige Worldwide - {{ title }}</title>
   14 :     {% else %}
   15 :       <title>Prestige Worldwide - </title>
   16 :     {% endif %}
   17 :     
   18 :   </head>
   19 :   <body>
   20 :     <header class="site-header">


Traceback:

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _resolve_lookup
  829.                     current = current[bit]

During handling of the above exception ('ImageFieldFile' object is not subscriptable), another exception occurred:

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py" in inner
  34.             response = get_response(request)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "C:\Users\Maksims\Desktop\CA4106-Cloud-Computing\test\src\projects\views.py" in createListing
  35.     return render(request, 'createListing.html', {'listing_form': link})

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\shortcuts.py" in render
  36.     content = loader.render_to_string(template_name, context, request, using=using)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader.py" in render_to_string
  62.     return template.render(context, request)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\backends\django.py" in render
  61.             return self.template.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  171.                     return self._render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _render
  163.         return self.nodelist.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  937.                 bit = node.render_annotated(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  904.             return self.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  150.             return compiled_parent._render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _render
  163.         return self.nodelist.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  937.                 bit = node.render_annotated(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  904.             return self.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader_tags.py" in render
  62.                 result = block.nodelist.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  937.                 bit = node.render_annotated(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render_annotated
  904.             return self.render(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in render
  987.             output = self.filter_expression.resolve(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in resolve
  671.                 obj = self.var.resolve(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in resolve
  796.             value = self._resolve_lookup(context)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\base.py" in _resolve_lookup
  837.                         current = getattr(current, bit)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\fields\files.py" in url
  62.         return self.storage.url(self.name)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\storages\backends\s3boto3.py" in url
  620.         params['Bucket'] = self.bucket.name

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\storages\backends\s3boto3.py" in bucket
  326.             self._bucket = self._get_or_create_bucket(self.bucket_name)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\storages\backends\s3boto3.py" in _get_or_create_bucket
  363.         bucket = self.connection.Bucket(name)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\boto3\resources\factory.py" in create_resource
  474.                            client=self.meta.client)(*args, **kwargs)

File "C:\Users\Maksims\AppData\Local\Programs\Python\Python37-32\lib\site-packages\boto3\resources\base.py" in __init__
  119.                     'Required parameter {0} not set'.format(identifier))

Exception Type: ValueError at /projects/createListing
Exception Value: Required parameter name not set


Solution 1:[1]

as @jordanm2 said, I had AWS_BUCKET_NAME instead of AWS_STORAGE_BUCKET_NAME

Solution 2:[2]

I just pasted the key AWS_STORAGE_BUCKET_NAME = 'bucket-name' on top in the settings.py file and it worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 russianmax
Solution 2 uc.uc