Por favor, preciso de ajuda com o erro:
ViewDoesNotExist at /
Could not import perfis.views.index. View does not exist in module perfis.views.
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.7.4
Exception Type: ViewDoesNotExist
Exception Value:
Could not import perfis.views.index. View does not
urls.py (connection):
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'connectedin.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('perfis.urls'))
)
urls.py (perfis):
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'connectedin.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'perfis.views.index')
)
views.py
from django.shortcuts import render
def index(request):
return render(request, 'index.html')
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>olá no html</h1>
</body>
</html>
Diretório do projeto
./perfis:
total 14
drwxr-xr-x 1 gandr 197611 0 Apr 4 12:14 ./
drwxr-xr-x 1 gandr 197611 0 Apr 4 11:37 ../
-rw-r--r-- 1 gandr 197611 0 Apr 4 11:37 __init__.py
-rw-r--r-- 1 gandr 197611 152 Apr 4 11:38 __init__.pyc
-rw-r--r-- 1 gandr 197611 63 Apr 4 11:37 admin.py
-rw-r--r-- 1 gandr 197611 209 Apr 4 11:38 admin.pyc
drwxr-xr-x 1 gandr 197611 0 Apr 4 11:38 migrations/
-rw-r--r-- 1 gandr 197611 57 Apr 4 11:37 models.py
-rw-r--r-- 1 gandr 197611 206 Apr 4 11:38 models.pyc
drwxr-xr-x 1 gandr 197611 0 Apr 4 11:59 templates/
-rw-r--r-- 1 gandr 197611 60 Apr 4 11:37 tests.py
-rw-r--r-- 1 gandr 197611 280 Apr 4 12:20 urls.py
-rw-r--r-- 1 gandr 197611 391 Apr 4 12:14 urls.pyc
-rw-r--r-- 1 gandr 197611 97 Apr 4 12:17 views.py
-rw-r--r-- 1 gandr 197611 212 Apr 4 12:14 views.pyc
./perfis/migrations:
total 5
drwxr-xr-x 1 gandr 197611 0 Apr 4 11:38 ./
drwxr-xr-x 1 gandr 197611 0 Apr 4 12:14 ../
-rw-r--r-- 1 gandr 197611 0 Apr 4 11:37 __init__.py
-rw-r--r-- 1 gandr 197611 163 Apr 4 11:38 __init__.pyc
./perfis/templates:
total 5
drwxr-xr-x 1 gandr 197611 0 Apr 4 11:59 ./
drwxr-xr-x 1 gandr 197611 0 Apr 4 12:14 ../
-rw-r--r-- 1 gandr 197611 295 Apr 4 11:59 index.html