Sha*_*vek 0 python django pycharm
我是Django Upgrade的新手,我尝试将版本从1.6.5升级到1.8.4.我手动安装1.8.4使用sudo python setup.py install.当我启动pycharm时,我得到以下错误.我检查__init__.py了检查错误,并试图找到1.8.4的示例文件以供参考.有人可以解释一下 - 如何逐步解决这些错误.
Failed to get real commands on module "albatross": python process died with code 1: Traceback (most recent call last):
File "/home/ritesh/Development/pycharm-4.5.3/helpers/pycharm/_jb_manage_tasks_provider.py", line 20, in <module>
django.setup()
File "/usr/local/lib/python2.7/dist-packages/Django-1.8.4-py2.7.egg/django/__init__.py", line 17, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/local/lib/python2.7/dist-packages/Django-1.8.4-py2.7.egg/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/Django-1.8.4-py2.7.egg/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/Django-1.8.4-py2.7.egg/django/conf/__init__.py", line 108, in __init__
"Please fix your settings." % setting)
django.core.exceptions.ImproperlyConfigured: The TEMPLATE_DIRS setting must be a tuple. Please fix your settings.
Run Code Online (Sandbox Code Playgroud)
TEMPLATE_DIR:
import os
CURRENT_PATH = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_DIRS = (
CURRENT_PATH + '/templates'
)
Run Code Online (Sandbox Code Playgroud)
这个:
TEMPLATE_DIRS = (
CURRENT_PATH + '/templates'
)
Run Code Online (Sandbox Code Playgroud)
是不是一个tuple,它只是CURRENT_PATH + 'templates'字符串.是什么让a tuple不是parens而是逗号,即:
>>> t = ("aaa")
>>> t
'aaa'
>>> type(t)
<type 'str'>
>>> t = "aaa", "bb"
>>> t
('aaa', 'bb')
>>> type(t)
<type 'tuple'>
>>> t = "aaa",
>>> t
('aaa',)
>>> type(t)
<type 'tuple'>
>>>
Run Code Online (Sandbox Code Playgroud)
唯一的例外是一个空的litteral表达式tuple(我假设出于可读性原因?)拼写()而不是,
除了这种特殊情况,一个tuple小屋附近的parens在技术上是无用的,仅用于可读性.
| 归档时间: |
|
| 查看次数: |
521 次 |
| 最近记录: |