Error when using django.template

后端 未结 6 934
面向向阳花
面向向阳花 2021-01-31 05:02

I\'m a beginner in django and I got a lot of errors when using template module from django. The following works from the python shell:

from django import templat         


        
6条回答
  •  深忆病人
    2021-01-31 05:23

    To fix this issue, you need to run it in python manage.py shell instead of just python.

    Reason: Well, many parts of Django rely on settings and you won't be able to use them until it knows which settings file to use. When you run it on python manage.py shell, Django knows which settings file to use and does the job for you.

提交回复
热议问题