2016-06-26 118 views
-3

我開始學習Django的教程,而當我想運行蟒蛇manage.py runserver命令錯誤django.core.exceptions.ImproperlyConfigured:T

python manage.py runserver 

存在很多錯誤 回溯(最近通話最後): 文件 「manage.py」,10號線,在 execute_from_command_line(sys.argv中) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/ init .py「,第338行,在execute_from_command_line utility.execute() 文件」/home/sarfraz/.local/lib/python 2.7/site-packages/django/core/management/init .py「,line 330,in execute self.fetch_command(subcommand).run_from_argv(self.argv) File」/home/sarfraz/.local/lib /python2.7/site-packages/django/core/management/ init .py「,第190行,在fetch_command中 klass = load_command_class(app_name,子命令) 文件」/home/sarfraz/.local/lib/python2 .7/site-packages/django/core/management/init .py「,第40行,在load_command_class中 module = import_module('%s.management.commands。%s'%(app_name,name)) File 「/usr/lib/python2.7/importlib/ init .py」,第37行,在import_module import(name) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/commands/runserver.py」,第14行,來自django.db的 .migrations.executor import MigrationExecutor 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/executor.py」,第6行,來自.loader的 import MigrationLoader File 「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/loader.py」,第10行,來自django.db.migrations.recorder的 import MigrationRecorder 文件「/ home /sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py「,第9行,在 類MigrationRecorder(object): 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py」,第23行,在MigrationRecorder class Migration(models.Model): File「/ home /sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py「,第24行,在遷移中 app = models.CharField(max_length = 255) File」/ home/sarfraz /.local/lib/python2.7/site-packages/django/db/models/fields/ init .py「,line 1081,in init super(CharField,self)。 init(* args,** kwargs) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/ init.py」,第161行,在初始化 self.db_tablespace = db_tablespace或settings.DEFAULT_INDEX_TABLESPACE 文件 「/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/ INIT py」 爲48行,在GETATTR self._setup(名) 文件 「/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/ 初始化 py」 爲44行,在_setup 自我。 _wrapped =設置(s ettings_module) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/ init。PY」,線路108,在初始化 ‘請解決您的設置’設置%) django.core.exceptions.ImproperlyConfigured:。該TEMPLATE_DIRS設置必須是一個元組請修正您的設置 回溯(最近通話最後): 文件「manage.py」,第10行,在 execute_from_command_line(sys.argv) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/ init .py「,第338行,在execute_from_command_line utility.execute() 文件」/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/ init .py「,第330行,執行 self.fetch_command(subcommand).run_from_argv(self.argv) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/ init .py」,第190行,在fetch_command klass = load_command_class(app_name,子命令) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/core/management/ init .py」,第40行,in load_command_class module = import_module('%s.management.commands。%s'%(app_name,name)) 文件「/usr/lib/python2.7/importlib/ init .py」,第37行,位於import_module 進口(名稱) 文件「/home/sarfraz/.loca l/lib/python2.7/site-packages/django/core/management/commands/runserver.py「,第14行,來自django.db.migrations.executor的 import MigrationExecutor 文件」/home/sarfraz/.local /lib/python2.7/site-packages/django/db/migrations/executor.py「,第6行,在 from .loader import MigrationLoader 文件」/home/sarfraz/.local/lib/python2.7/site -packages/django/db/migrations/loader.py「,第10行,來自django.db.migrations.recorder的 import MigrationRecorder 文件」/home/sarfraz/.local/lib/python2.7/site-packages/ django/db/migrations/recorder.py「,第9行,在 類MigrationRecorder(object): 文件」/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder .py「,第23行,在MigrationRecorder class M遷移(models.Model): 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/migrations/recorder.py」,第24行,遷移中 app = models.CharField (MAX_LENGTH = 255) 文件 「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/ INIT py」 爲,線1081,在初始化 超級(CharField,自我)。 init(* args,** kwargs) 文件「/home/sarfraz/.local/lib/python2.7/site-packages/django/db/models/fields/ init.py」,第161行,在初始化 self.db_tablespace = db_tablespace或settings.DEFAULT_INDEX_TABLESPACE 文件 「/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/ INIT py」 爲48行,在GETATTR self._setup(名) 文件 「/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/ 初始化 py」 爲44行,在_setup 自我。 _wrapped =設置(s ettings_module) 文件 「/home/sarfraz/.local/lib/python2.7/site-packages/django/conf/ 初始化 py」 爲,線108,在初始化 「請解決您的設置。」 %設置) django.core.exceptions。不正確配置:TEMPLATE_DIRS設置必須是元組。請修復您的設置。

並且在我的項目/ settings.py TEMPLATE_DIRS =( 「/家/ sarfraz/Django的/ crepes_bretonnes /模板/」 )

希望很明顯的LIGNE。

回答

1

添加逗號括號之間關閉值的末尾,否則它不是一個tuple

TEMPLATE_DIRS = ("/home/sarfraz/django/crepes_bretonnes/templates/",)

應該解決的問題。希望它有幫助。

+0

我添加一個逗號,但它不起作用,同樣的錯誤出現。 –

+0

Oups,我在雙引號之前添加了一個逗號,我改變了它,並知道它的工作原理!謝謝 –

相關問題