python 3.x - No module named 'django.templates' -
i using python 3.4, django 1.8. using pycharm developing. while running program ,i getting 'no module named 'django.templates'' error.
settings.py
""" django settings dj project. generated 'django-admin startproject' using django 1.8.1. more information on file, see https://docs.djangoproject.com/en/1.8/topics/settings/ full list of settings , values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # build paths inside project this: os.path.join(base_dir, ...) import os base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # quick-start development settings - unsuitable production # see https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # security warning: keep secret key used in production secret! secret_key = 'uhqkhi7h_w48bz*gnr+_!roaa8@c_)087a(!ees)mn2=n=lv-r' # security warning: don't run debug turned on in production! debug = true allowed_hosts = [] # application definition installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog', ) middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', 'django.middleware.security.securitymiddleware', ) root_urlconf = 'dj.urls' templates = [ { 'backend': 'django.templates.backends.django.djangotemplates', 'dirs': [], 'app_dirs': true, 'options': { 'context_processors': [ 'django.templates.context_processors.debug', 'django.templates.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] template_loaders = ( 'django.template.loaders.app_directories.load_template_source', ) wsgi_application = 'dj.wsgi.application' # database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } # internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true # static files (css, javascript, images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ static_url = '/static/' template_dirs = ( os.path.join(base_dir, 'templates'), )
blog/urls.py
from django.conf.urls import include, url . import views urlpatterns = [ url(r'^$', views.post_list), ]
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("django_settings_module", "dj.settings") django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
post_list.html
<html> <body> <p> hihiiii </p> </body> </html>
dj/urls.py
from django.conf.urls import include, url django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'', include('blog.urls')), ]
error
importerror @ / no module named 'django.templates' request method: request url: http://127.0.0.1:8000/ django version: 1.8.1 exception type: importerror exception value: no module named 'django.templates' exception location: c:\python34\lib\importlib\__init__.py in import_module, line 109 python executable: c:\python34\python.exe python version: 3.4.1 python path: ['c:\\users\\ankur anand\\pycharmprojects\\dj', 'c:\\users\\ankur anand\\pycharmprojects\\dj', 'c:\\windows\\system32\\python34.zip', 'c:\\python34\\dlls', 'c:\\python34\\lib', 'c:\\python34', 'c:\\python34\\lib\\site-packages'] server time: fri, 15 may 2015 18:08:59 +0530
as error mentions, there's no such thing django.templates
.
however, there is django.template
. you'll want remove s
of relevant lines refer templates
.
while you're @ it, should move template_loaders
proper location (within templates
setting).
read more in docs.
Comments
Post a Comment