I've followed through "Deploying a Django Application to AWS Elastic Beanstalk" tutorial provided by Amazon but I am trying to run the project locally and I am getting a KeyValue error that I have been unable to find a solution for.
When running the command:
$ ./manage.py help
I get this error returned:
File "/Users/dave/Sites/djangodev/djangodev/settings.py", line 17, in <module>
'NAME': os.environ['RDS_DB_NAME'],
File "/Users/dave/.virtualenvs/djangodev/bin/../lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'RDS_DB_NAME'`
I'm actually trying to run $ ./manage.py runserver
but that returns a runserver does not exist error. It is because there is an error in my settings.py file.
settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ['RDS_DB_NAME'],
'USER': os.environ['RDS_USERNAME'],
'PASSWORD': os.environ['RDS_PASSWORD'],
'HOST': os.environ['RDS_HOSTNAME'],
'PORT': os.environ['RDS_PORT'],
}
}
This runs just fine on AWS. Locally is does not. And I'm not surprised since RDS_DB_NAME is not in my local os.environ dictionary.
There was another stackoverflow question that has not provided a solution yet either. Elastic Beanstalk not creating RDS Parameters
I have it running on AWS, it's just getting a local instance to run that is being difficult.