在Amazon Ec2错误上部署Django

时间:2014-09-21 17:52:46

标签: python django amazon-web-services amazon-ec2

我正在尝试在我的EC2实例上使用Django启动一个项目,但是当我输入时:

django-admin.py startproject mysite

这就是我得到的:

    Traceback (most recent call last):
  File "/usr/bin/django-admin.py", line 2, in <module>
    from django.core import management
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 68
    commands = {name: 'django.core' for name in find_commands(__path__[0])}
                                      ^
SyntaxError: invalid syntax

我一直试图在网上找到一些参考,但我找不到任何参考。我认为Python2.6.9,这是EC2上的版本不支持Django,但事实并非如此。

让我怀疑的是我在机器上安装Django时得到的输出,但是有几个语法错误不响铃。

就是这样:

    Downloading/unpacking django
  Running setup.py egg_info for package django
    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: django
  Running setup.py install for django
    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/core/management/__init__.py', 68, 39, "    commands = {name: 'django.core' for name in find_commands(__path__[0])}\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/core/management/commands/makemessages.py', 351, 44, "        dir_suffixes = {'%s*' % path_sep for path_sep in {'/', os.sep}}\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/utils/lru_cache.py', 28, 34, '                 fasttypes = {int, str, frozenset, type(None)},\n'))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/humanize/tests.py', 95, 40, "        with translation.override('ja'), self.settings(USE_L10N=True):\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/formtools/tests/wizard/wizardtests/tests.py', 128, 40, "        with open(THIS_FILE, 'rb') as f, temp_storage.open(UPLOADED_FILE_NAME) as f2:\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py', 160, 40, "        with open(THIS_FILE, 'rb') as f, temp_storage.open(UPLOADED_FILE_NAME) as f2:\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/auth/tests/test_forms.py', 123, 42, "        with self.settings(USE_I18N=True), translation.override('pt-br', deactivate=True):\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/gis/db/backends/postgis/operations.py', 79, 34, "    valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'}\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/gis/db/backends/oracle/operations.py', 86, 32, "    valid_aggregates = {'Union', 'Extent'}\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/gis/db/backends/spatialite/operations.py', 68, 33, "    valid_aggregates = {'Extent', 'Union'}\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/contrib/gis/db/models/constants.py', 4, 17, "    'bbcontains', 'bboverlaps', 'contained', 'contains',\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/test/signals.py', 103, 41, "    if kwargs['setting'] in {'LANGUAGES', 'LANGUAGE_CODE', 'LOCALE_PATHS'}:\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/db/backends/mysql/schema.py', 39, 61, "        return field.db_type(self.connection) in {'longtext', 'longblob'}\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/db/models/fields/__init__.py', 639, 21, "            'iexact', 'contains', 'icontains',\n"))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/db/utils.py', 190, 44, '    TEST_SETTING_RENAMES_REVERSE = {v: k for k, v in TEST_SETTING_RENAMES.items()}\n'))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/template/loader_tags.py', 145, 19, '                for name, var in six.iteritems(self.extra_context)\n'))

    SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/django/forms/utils.py', 57, 34, '        return {f: e.as_data() for f, e in self.items()}\n'))

    changing mode of /usr/bin/django-admin.py to 755
    Installing django-admin script to /usr/bin
Successfully installed django
Cleaning up...

我很确定我不是第一个在EC2上使用Django的人,所以我想知道是否有人已经遇到过这个问题。

提前致谢。

0 个答案:

没有答案