Preciso de um help...

4 views
Skip to first unread message

Felipe 19

unread,
May 14, 2008, 12:32:22 PM5/14/08
to Django Brasil
E ae pessoal sou novato aqui no grupo de django e tambem sou
iniciante no Django

e estou com um problema preciso de um help do pessoal do grupo.


NameError at /dicas/
global name 'Dica' is not defined
Request Method: GET
Request URL: http://localhost:8000/dicas/
Exception Type: NameError
Exception Value: global name 'Dica' is not defined
Exception Location: D:\felipe\workspace\rheal\..\rheal\candidato
\views.py in dicas, line 18

Traceback (innermost last)
Switch to copy-and-paste view

* C:\Python25\lib\site-packages\django\core\handlers\base.py in
get_response
70. # Apply view middleware
71. for middleware_method in self._view_middleware:
72. response = middleware_method(request, callback,
callback_args, callback_kwargs)
73. if response:
74. return response
75.
76. try:
77. response = callback(request, *callback_args,
**callback_kwargs) ...
78. except Exception, e:
79. # If the view raised an exception, run it through
exception
80. # middleware, and if the exception middleware returns a
81. # response, use that. Otherwise, reraise the exception.
82. for middleware_method in self._exception_middleware:
83. response = middleware_method(request, e)
▶ Local vars
Variable Value
callback
<function dicas at 0x010EEA30>
callback_args
()
callback_kwargs
{}
debug
<module 'django.views.debug' from 'C:\Python25\Lib\site-packages
\django\views\debug.pyc'>
e
NameError("global name 'Dica' is not defined",)
exceptions
<module 'django.core.exceptions' from 'C:\Python25\Lib\site-
packages\django\core\exceptions.pyc'>
mail_admins
<function mail_admins at 0x01077C70>
middleware_method
<bound method XViewMiddleware.process_view of
<django.middleware.doc.XViewMiddleware object at 0x0107D410>>
request
<WSGIRequest GET:<MultiValueDict: {}>, POST:<MultiValueDict:
{}>, COOKIES:{'sessionid': '94881d22aa110d4979a2a56a27fa1586'}, META:
{'ALLUSERSPROFILE': 'C:\\Documents and Settings\\All Users',
'APPDATA': 'C:\\Documents and Settings\\Administrador\\Dados de
aplicativos', 'CLASSPATH': '.;.;C:\\ARQUIV~1\\JMF21~1.1E\\lib\
\sound.jar;C:\\ARQUIV~1\\JMF21~1.1E\\lib\\jmf.jar;C:\\ARQUIV~1\
\JMF21~1.1E\\lib;', 'CLIENTNAME': 'Console', 'COMMONPROGRAMFILES': 'C:\
\Arquivos de programas\\Arquivos comuns', 'COMPUTERNAME': 'FELIPE',
'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'CONTENT_LENGTH': '',
'CONTENT_TYPE': 'text/plain', 'DJANGO_SETTINGS_MODULE':
'rheal.settings', 'FP_NO_HOST_CHECK': 'NO', 'GATEWAY_INTERFACE': 'CGI/
1.1', 'HOMEDRIVE': 'C:', 'HOMEPATH': '\\Documents and Settings\
\Administrador', 'HTTP_ACCEPT': 'text/xml,application/xml,application/
xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'pt-
br,pt;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CACHE_CONTROL': 'max-age=0',
'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
'sessionid=94881d22aa110d4979a2a56a27fa1586', 'HTTP_HOST': 'localhost:
8000', 'HTTP_KEEP_ALIVE': '300', 'HTTP_REFERER': 'http://localhost:
8000/index/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT
5.1; pt-BR; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
'LOGONSERVER': '\\\\FELIPE', 'NUMBER_OF_PROCESSORS': '2', 'OS':
'Windows_NT', 'PATH': 'C:\\Arquivos de programas\\Java\\jre1.6.0_05\
\bin\\client;C:\\Arquivos de programas\\Java\\jre1.6.0_05\\bin;C:\
\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\
\Python25;C:\\Python25\\Lib\\site-packages\\django\\bin;C:\\Arquivos
de programas\\cvsnt;C:\\Arquivos de programas\\MySQL\\MySQL Server 5.0\
\bin; D:\\bats\\jb.bat;C:\\Arquivos de programas\\Arquivos comuns\
\Adobe\\AGL;C:\\Arquivos de programas\\QuickTime\\QTSystem\\',
'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH',
'PATH_INFO': '/dicas/', 'PROCESSOR_ARCHITECTURE': 'x86',
'PROCESSOR_IDENTIFIER': 'x86 Family 15 Model 4 Stepping 9,
GenuineIntel', 'PROCESSOR_LEVEL': '15', 'PROCESSOR_REVISION': '0409',
'PROGRAMFILES': 'C:\\Arquivos de programas', 'PROMPT': '$P$G',
'PYTHONPATH': 'D:\\felipe\\workspace\\rheal\\src;C:\\Python25;C:\
\Python25\\DLLs;C:\\Python25\\Lib;C:\\Python25\\Lib\\lib-tk;C:\
\Python25\\Lib\\plat-win;C:\\Python25\\Lib\\site-packages;C:\\Python25\
\Lib\\site-packages\\PIL;D:\\django', 'QTJAVA': 'C:\\Arquivos de
programas\\Java\\jre1.6.0_05\\lib\\ext\\QTJava.zip', 'QUERY_STRING':
'', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': '', 'REQUEST_METHOD':
'GET', 'RUN_MAIN': 'true', 'SCRIPT_NAME': '', 'SERVER_NAME':
'localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.5.1', 'SESSIONNAME':
'Console', 'SYSTEMDRIVE': 'C:', 'SYSTEMROOT': 'C:\\WINDOWS', 'TEMP':
'C:\\DOCUME~1\\ADMINI~1\\CONFIG~1\\Temp', 'TMP': 'C:\\DOCUME~1\
\ADMINI~1\\CONFIG~1\\Temp', 'USERDOMAIN': 'FELIPE', 'USERNAME':
'Administrador', 'USERPROFILE': 'C:\\Documents and Settings\
\Administrador', 'WINDIR': 'C:\\WINDOWS', 'wsgi.errors': <open file
'<stderr>', mode 'w' at 0x00A1F0B0>, 'wsgi.file_wrapper': <class
'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input':
<socket._fileobject object at 0x010FF6B0>, 'wsgi.multiprocess': False,
'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme':
'http', 'wsgi.version': (1, 0)}>
resolver
<django.core.urlresolvers.RegexURLResolver object at 0x0107D4D0>
response
None
self
<django.core.handlers.wsgi.WSGIHandler object at 0x00CB1EB0>
settings
<django.conf.LazySettings object at 0x00B4DE70>
urlconf
'rheal.urls'
urlresolvers
<module 'django.core.urlresolvers' from 'C:\Python25\Lib\site-
packages\django\core\urlresolvers.pyc'>
* D:\felipe\workspace\rheal\..\rheal\candidato\views.py in dicas
11. return render_to_response('index.html',{'i':i})
12.
13. def candidatos(request):
14. c = TextoDiverso.objects.get(key = 'Candidatos')
15. return render_to_response('candidatos.html', {'c':c})
16.
17. def dicas(request):
18. di = Dica.objects.all() ...
19. return render_to_response('dicas.html', {'di':di})
20.
21.
▶ Local vars




desde já obrigado e o grupo ta muito bom =)

Felipe 19

unread,
May 14, 2008, 12:54:20 PM5/14/08
to Django Brasil
PESSOAL ACABEI DE CONSEGUIR RESOLVER O PROBLEMA BRIGADÃO A
TODOS AII


O GRUPO TA OTIMO APRA TIRAR DUVIDAS VLWW

MAYRON

unread,
May 14, 2008, 12:54:54 PM5/14/08
to django...@googlegroups.com
Opa Felipe...


Exception Value:        global name 'Dica' is not defined
Exception Location:     D:\felipe\workspace\rheal\..\rheal\candidato\views.py in dicas, line 18

Procure ai na linha 18...


       17. def dicas(request):
       18. di = Dica.objects.all() ...
       19. return render_to_response('dicas.html', {'di':di})

existem mesmo esses "..." ai no código???



--
Mayron Cachina Santiago
http://cachina.wordpress.com
http://job4dev.com

Andrews Medina

unread,
May 14, 2008, 12:55:48 PM5/14/08
to django...@googlegroups.com
Olá Felipe,

On Wed, May 14, 2008 at 12:32 PM, Felipe 19 <182f...@gmail.com> wrote:
>
> E ae pessoal sou novato aqui no grupo de django e tambem sou
> iniciante no Django

Seja bem vindo.

>
> e estou com um problema preciso de um help do pessoal do grupo.
>

Estamos aqui para isso!

> 16.
> 17. def dicas(request):
> 18. di = Dica.objects.all() ...
> 19. return render_to_response('dicas.html', {'di':di})
> 20.

Tu importou seu model Dica no seu arquivo views.py? PAra isso faça:
'from projeto.app.models import Dica'

[]'s
--
Andrews Medina
www.andrewsmedina.com

Felipe 19

unread,
May 14, 2008, 1:02:39 PM5/14/08
to Django Brasil
Era exatamente isso rsrsrs

eu já estava desconfiado de ser algum import mas já estava com tantos
imports la que nem imaginei que tinha esquecido logo esse rsrsrs

mas era isso mesmo era só um import agora isso serve para os novatos
como eu tirar as duvidas rsrs

vlw galera ate mais

On 14 maio, 13:55, "Andrews Medina" <andrewsmed...@gmail.com> wrote:
> Olá Felipe,
>
Reply all
Reply to author
Forward
0 new messages