AWS Elastic Beanstalk manage.py上的Django

时间:2014-06-12 15:44:17

标签: django amazon elastic-beanstalk manage.py

我按照以下文档在AWS Elastic Beanstalk上安装了django。 http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html

现在我开始写我的第一个djangoapp,着名的民意调查。问题是当我使用命令 python manage.py startapp polls 时,我收到错误未知命令:startapp。当我使用 python manage.py syncdb 时,错误未知命令:syncdb。

当我使用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   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'

如何超越这个?

由于

1 个答案:

答案 0 :(得分:1)

看起来你有使用环境变量的设置:

  • 如果您使用os.environ['RDS_DB_NAME']作为数据库,请检查数据库部分中的settings.py。
  • 检查您是否在RDS_DB_NAME~/.profile~/.bashrc中配置了环境变量~/.bash_profile,或者在使用后使用导出命令export RDS_DB_NAME=my_dabatase_name尝试manage.py