2
我遵循以下文檔並在AWS Elastic Beanstalk上安裝了django。 http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.htmlAWS上的Django Elastic Beanstalk manage.py
現在我開始寫我的第一個djangoapp,着名的民意調查。問題是當我使用命令python manage.py startapp民意調查,我得到一個錯誤未知命令: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'
如何突破這個?
感謝
文件稱..所有的參數都可以通過ENV變量。編輯/root/mysite/settings.py以使用Amazon RDS,當啓動Python容器時,可以關聯Amazon RDS數據庫實例。 Amazon RDS參數的值可通過環境變量獲得。 數據庫= { '缺省':{ '發動機': 'django.db.backends.mysql', 'NAME':os.environ [ 'RDS_DB_NAME'], '用戶':os.environ ['RDS_USERNAME '], '密碼':os.environ [' RDS_PASSWORD '], 'HOST':os.environ [' RDS_HOSTNAME '], 'PORT':os.environ [' RDS_PORT'], } } – Aragorn
在這種情況下,你應該創建你自己的本地設置只是爲了發展的目的,這個答案可以工作http://stackoverflow.com/questions/20078666/aws-beanstalk-django-python-running-local-issue – soloidx