Aragorn
Aragorn

Reputation: 21

Django on AWS Elastic Beanstalk manage.py

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

Upvotes: 2

Views: 1172

Answers (1)

soloidx
soloidx

Reputation: 749

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

Upvotes: 1

Related Questions