我在AWS cloud9中有一个项目。
我尝试通过LinkedIn或Facebook登录,我使用django。
当我运行命令时:python manage.py runserver 0.0.0.0:8080
我得到了
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", line 307, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 56, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.4/site-packages/django/conf/__init__.py", line 110, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib64/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/ec2-user/environment/gowith/django_social_project/django_social_project/settings.py", line 17, in <module>
from config import *
File "/usr/local/lib/python3.4/site-packages/config.py", line 733
except Exception, e:
^
SyntaxError: invalid syntax
答案 0 :(得分:0)
except Exception, e:
中的语法错误是python 3中的原因,你应该写except (Exception, e):
如果使用外部包,请确保它与Python3兼容,否则请自行使用python 2.7。