python - Elastic Beanstalk not creating RDS Parameters -


i'm following tutorial in effort create django application on aws.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_python_django.html

i able working local sqlite database trying push app production server. while going through elastic beanstalk init process, choose create rds instance.

my mysite/settings.py looks this:

import os

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'],     } } 

i should have access rds parameters @ point don't. manage.py file becomes unresponse.

(djangodev)laptop-id:mysite user-name$ python manage.py runserver unknown command: 'runserver' type 'manage.py help' usage.  (djangodev)laptop-id:mysite use-name$ python manage.py usage: manage.py subcommand [options] [args]  options:   -v verbosity, --verbosity=verbosity                         verbosity level; 0=minimal output, 1=normal output,                         2=verbose output, 3=very verbose output   --settings=settings   python path settings module, e.g.                         "myproject.settings.main". if isn't provided,                         django_settings_module environment variable                         used.   --pythonpath=pythonpath                         directory add python path, e.g.                         "/home/djangoprojects/myproject".   --traceback           print traceback on exception   --version             show program's version number , exit   -h, --help            show message , exit traceback (most recent call last):   file "manage.py", line 10, in <module>     execute_from_command_line(sys.argv)   file "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line     utility.execute()   file "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 376, in execute     sys.stdout.write(self.main_help_text() + '\n')   file "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 242, in main_help_text     name, app in six.iteritems(get_commands()):   file "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 109, in get_commands     apps = settings.installed_apps   file "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__     self._setup(name)   file "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup     self._wrapped = settings(settings_module)   file "/usr/local/lib/python2.7/site-packages/django/conf/__init__.py", line 132, in __init__     mod = importlib.import_module(self.settings_module)   file "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module     __import__(name)   file "/users/andrewcopp/developer/mysite/mysite/settings.py", line 17, in <module>    'name': os.environ['rds_db_name'],                      # or path database file if using sqlite3.   file "/tmp/djangodev/bin/../lib/python2.7/userdict.py", line 23, in __getitem__     raise keyerror(key) keyerror: 'rds_db_name' 

any idea might overlooked? more information can provide make things clear

you need local fallback different database in settings.

in settings.py file, replace database variable this:

databases = {}  try:     local_settings import * except importerror, e:     databases = {         'default': {             'engine': 'django.db.backends.mysql',             'name': os.environ['rds_db_name'],             'user': os.environ['rds_username'],             'password': os.environ['             'host': os.environ['rds_hostname'],             'port': os.environ['rds_port'],         }     } 

now create local_settings.py in same directory settings.py , enter following code:

databases = {     'default': {         'engine': 'django.db.backends.sqlite3',         'name': 'db.djangodb',         'user': '',         'password': '',         'host': '',         'port': '',     } }  media_root = '' media_url = '' static_root = '' static_url = '/static/' staticfiles_dirs = () template_dirs = () 

now add local_settings.py file .gitignore file.

run $ python manage.py syncdb , can run django server locally.

most of copy pasta blog post found: http://grigory.ca/2012/09/getting-started-with-django-on-aws-elastic-beanstalk/


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -