2

I followed the below documentation and installed django on AWS Elastic Beanstalk. http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

Now I started writing my first djangoapp, the famous polls. The problem is when I use the command python manage.py startapp polls, I get an error Unknown Command : startapp. When I use the python manage.py syncdb, the error Unknown Command : syncdb.

When I use python manage.py I get the following

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   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Print traceback on exception
  --version             show program's version number and exit
  -h, --help            show this help message and exit
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 366, in execute
    sys.stdout.write(self.main_help_text() + '\n')
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 231, in main_help_text
    for name, app in get_commands().iteritems():
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
    apps = settings.INSTALLED_APPS
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
    self._setup()
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/tmp/djangodev/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/mysite/mysite/settings.py", line 15, in <module>
    'NAME': os.environ['RDS_DB_NAME'],                      # Or path to database file if using sqlite3.
  File "/tmp/djangodev/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'RDS_DB_NAME'

How to get past this ??

Thanks

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Aragorn
  • 21
  • 3

1 Answers1

1

It looks like you have a settings using environment variables:

  • Check your settings.py, in the database section, if you are using the os.environ['RDS_DB_NAME'] as database.
  • Check if you had configured the environment variable RDS_DB_NAME probably in your ~/.profile or ~/.bashrc or ~/.bash_profile or try with an export command export RDS_DB_NAME=my_dabatase_name after use the manage.py
soloidx
  • 729
  • 6
  • 12
  • The document says.. all the parameters are available through ENV Variables. edit /root/mysite/settings.py to use Amazon RDS, when you launch a Python container, you can associate an Amazon RDS DB Instance. The values of the Amazon RDS parameters are available through environment variables. 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'], } } – Aragorn Jun 12 '14 at 17:02
  • In that case you should create you own local settings just for development purposes this answer could work http://stackoverflow.com/questions/20078666/aws-beanstalk-django-python-running-local-issue – soloidx Jun 12 '14 at 19:41