Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

Video: A página principal da aplicação

A aplicação esta dando erro, o que fiz de errado

settings.py
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'perfis'
)

--
views.py
from django.shortcuts import render
from django.http import HttpResponse

def index(request):
    return HttpResponse('Bem-vindo ao ConnectedIn')

--
urs.py
from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', perfis.views.index)
)

NameError at / name 'perfis' is not defined Request Method: GET Request URL: http://localhost:8000/ Django Version: 1.7.4 Exception Type: NameError Exception Value:name 'perfis' is not defined Exception Location: C:\Caca\Alura\Python\Django\projetoDjango\connectedin\connectedin\urls.py in , line 6 Python Executable: C:\Python27\python.exe Python Version: 2.7.13 Python Path:['C:\Caca\Alura\Python\Django\projetoDjango\connectedin', 'C:\WINDOWS\SYSTEM32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib', 'C:\Python27\lib\plat-win', 'C:\Python27\lib\lib-tk', 'C:\Python27', 'C:\Python27\lib\site-packages'] Server time: Fri, 24 Feb 2017 22:39:26 -0300 Traceback Switch to copy-and-paste view

C:\Python27\lib\site-packages\django\core\handlers\base.py in getresponse resolvermatch = resolver.resolve(request.pathinfo) ... ▶ Local vars C:\Python27\lib\site-packages\django\core\urlresolvers.py in resolve for pattern in self.urlpatterns: ... ▶ Local vars C:\Python27\lib\site-packages\django\core\urlresolvers.py in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ... ▶ Local vars C:\Python27\lib\site-packages\django\core\urlresolvers.py in urlconf_module self._urlconf_module = import_module(self.urlconf_name) ... ▶ Local vars C:\Python27\lib\importlib__init.py in import_module __import(name) ... ▶ Local vars C:\Caca\Alura\Python\Django\projetoDjango\connectedin\connectedin\urls.py in url(r'^$', perfis.views.index) ... ▶ Local vars Request information

GET No GET data POST No POST data FILES No FILES data COOKIES No cookie data META Variable Value TMP'C:\Users\Caca\AppData\Local\Temp' COMPUTERNAME'CACA_DONADELI' wsgi.multiprocessFalse PROCESSOR_LEVEL'6' RUN_MAIN'true' USERDOMAIN'CACA_DONADELI' HTTP_ACCEPT_LANGUAGE'pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4' wsgi.multithreadTrue SERVER_PROTOCOL'HTTP/1.1' SERVER_SOFTWARE'WSGIServer/0.1 Python/2.7.13' PSMODULEPATH'C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\' SCRIPT_NAMEu'' COMMONPROGRAMFILES'C:\Program Files (x86)\Common Files' PROCESSOR_IDENTIFIER'Intel64 Family 6 Model 69 Stepping 1, GenuineIntel' GIT'C:\Program Files\Git\git-bash.exe' VBOX_MSI_INSTALL_PATH'C:\Program Files\Oracle\VirtualBox\' PROGRAMFILES'C:\Program Files (x86)' PROCESSOR_REVISION'4501' SYSTEMROOT'C:\WINDOWS' QUERY_STRING'' PATH'C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\PROGRA~2\ULTRAE~1;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\;C:\Program Files (x86)\Brackets\command;C:\Program Files\Java\jdk1.8.0_112\bin;C:\Python27\;C:\Python27\Scripts;C:\Users\Caca\AppData\Roaming\npm;C:\Program Files (x86)\Microsoft VS Code\bin' PROGRAMFILES(X86)'C:\Program Files (x86)' CONTENT_LENGTH'' HTTP_UPGRADE_INSECURE_REQUESTS'1' HTTP_CACHE_CONTROL'max-age=0' HTTP_CONNECTION'keep-alive' TEMP'C:\Users\Caca\AppData\Local\Temp' REMOTE_ADDR'127.0.0.1' COMMONPROGRAMFILES(X86)'C:\Program Files (x86)\Common Files' PROCESSOR_ARCHITECTURE'x86' wsgi.url_scheme'http' ALLUSERSPROFILE'C:\ProgramData' SERVER_PORT'8000' LOCALAPPDATA'C:\Users\Caca\AppData\Local' HOMEPATH'\Users\Caca' USERDOMAIN_ROAMINGPROFILE'CACA_DONADELI' JAVA_HOME'C:\Program Files\Java\jdk1.8.0_112' PROGRAMW6432'C:\Program Files' USERNAME'Caca' HTTP_ACCEPT'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8' LOGONSERVER'\\MicrosoftAccount' PROMPT'$P$G' COMSPEC'C:\WINDOWS\system32\cmd.exe' PROGRAMDATA'C:\ProgramData' PATH_INFOu'/' ONEDRIVE'C:\Users\Caca\OneDrive' wsgi.input

HTTP_USER_AGENT'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36' HTTP_HOST'localhost:8000' SESSIONNAME'Console' PATHEXT'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC' ASL.LOG'Destination=file' FP_NO_HOST_CHECK'NO' WINDIR'C:\WINDOWS' wsgi.file_wrapper'' HTTP_ACCEPT_ENCODING'gzip, deflate, sdch, br' wsgi.version(1, 0) HOMEDRIVE'C:' APPDATA'C:\Users\Caca\AppData\Roaming' SERVER_NAME'Caca_Donadeli' wsgi.run_onceFalse REMOTE_HOST'' SYSTEMDRIVE'C:' GATEWAY_INTERFACE'CGI/1.1' CAMINHO'C:\oraclexe\app\oracle\product\11.2.0\server\bin;' wsgi.errors

NUMBER_OF_PROCESSORS'4' REQUEST_METHOD'GET' DJANGO_SETTINGS_MODULE'connectedin.settings' CONTENT_TYPE'text/plain' PROCESSOR_ARCHITEW6432'AMD64' COMMONPROGRAMW6432'C:\Program Files\Common Files' OS'Windows_NT' PUBLIC'C:\Users\Public' USERPROFILE'C:\Users\Caca' Settings Using settings module connectedin.settings Setting Value USE_L10NTrue USE_THOUSAND_SEPARATORFalse CSRF_COOKIE_SECUREFalse LANGUAGE_CODE'en-us' ROOT_URLCONF'connectedin.urls' MANAGERS() BASE_DIR'C:\Caca\Alura\Python\Django\projetoDjango\connectedin' TEST_NON_SERIALIZED_APPS[] DEFAULT_CHARSET'utf-8' SESSION_SERIALIZER'django.contrib.sessions.serializers.JSONSerializer' STATIC_ROOTNone ALLOWED_HOSTS[] MESSAGE_STORAGE'django.contrib.messages.storage.fallback.FallbackStorage' EMAIL_SUBJECT_PREFIX'[Django] ' SEND_BROKEN_LINK_EMAILSFalse STATICFILES_FINDERS('django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder') SESSION_CACHE_ALIAS'default' SESSION_COOKIE_DOMAINNone SESSION_COOKIE_NAME'sessionid' ADMIN_FOR() TIME_INPUT_FORMATS('%H:%M:%S', '%H:%M:%S.%f', '%H:%M') DATABASES{'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': 'C:\Caca\Alura\Python\Django\projetoDjango\connectedin\db.sqlite3', 'OPTIONS': {}, 'PASSWORD': u'**', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': 'UTC', 'USER': ''}} FILE_UPLOAD_DIRECTORY_PERMISSIONSNone FILE_UPLOAD_PERMISSIONSNone FILE_UPLOAD_HANDLERS('django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler') DEFAULT_CONTENT_TYPE'text/html' APPEND_SLASHTrue LOCALE_PATHS() DATABASE_ROUTERS[] DEFAULT_TABLESPACE'' YEAR_MONTH_FORMAT'F Y' STATICFILES_STORAGE'django.contrib.staticfiles.storage.StaticFilesStorage' CACHES{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} SERVER_EMAIL'root@localhost' SESSION_COOKIE_PATH'/' SILENCED_SYSTEM_CHECKS[] 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') USE_I18NTrue THOUSAND_SEPARATOR',' SECRET_KEYu'**' LANGUAGE_COOKIE_NAME'django_language' DEFAULT_INDEX_TABLESPACE'' TRANSACTIONS_MANAGEDFalse LOGGING_CONFIG'logging.config.dictConfig' TEMPLATE_LOADERS('django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader') FIRST_DAY_OF_WEEK0 WSGI_APPLICATION'connectedin.wsgi.application' TEMPLATE_DEBUGTrue X_FRAME_OPTIONS'SAMEORIGIN' CSRF_COOKIE_NAME'csrftoken' FORCE_SCRIPT_NAMENone USE_X_FORWARDED_HOSTFalse SIGNING_BACKEND'django.core.signing.TimestampSigner' SESSION_COOKIE_SECUREFalse CSRF_COOKIE_DOMAINNone FILE_CHARSET'utf-8' DEBUGTrue LANGUAGE_COOKIE_DOMAINNone DEFAULT_FILE_STORAGE'django.core.files.storage.FileSystemStorage' INSTALLED_APPS('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'perfis') LANGUAGES(('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-cn', 'Simplified Chinese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese'), ('zh-tw', 'Traditional Chinese')) COMMENTS_ALLOW_PROFANITIESFalse STATICFILES_DIRS() PREPEND_WWWFalse SECURE_PROXY_SSL_HEADERNone LANGUAGE_COOKIE_AGENone SESSION_COOKIE_HTTPONLYTrue DEBUG_PROPAGATE_EXCEPTIONSFalse INTERNAL_IPS() MONTH_DAY_FORMAT'F j' LOGIN_URL'/accounts/login/' SESSION_EXPIRE_AT_BROWSER_CLOSEFalse TIME_FORMAT'P' AUTH_USER_MODEL'auth.User' DATE_INPUT_FORMATS('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y') AUTHENTICATION_BACKENDS('django.contrib.auth.backends.ModelBackend',) EMAIL_HOST_PASSWORDu'**' PASSWORD_RESET_TIMEOUT_DAYSu'**' SESSION_FILE_PATHNone CACHE_MIDDLEWARE_ALIAS'default' SESSION_SAVE_EVERY_REQUESTFalse NUMBER_GROUPING0 SESSION_ENGINE'django.contrib.sessions.backends.db' CSRF_FAILURE_VIEW'django.views.csrf.csrf_failure' CSRF_COOKIE_PATH'/' LOGIN_REDIRECT_URL'/accounts/profile/' DECIMAL_SEPARATOR'.' IGNORABLE_404_URLS() MIGRATION_MODULES{} TEMPLATE_STRING_IF_INVALID'' LOGOUT_URL'/accounts/logout/' EMAIL_USE_TLSFalse FIXTURE_DIRS() EMAIL_HOST'localhost' DATE_FORMAT'N j, Y' MEDIA_ROOT'' DEFAULT_EXCEPTION_REPORTER_FILTER'django.views.debug.SafeExceptionReporterFilter' ADMINS() FORMAT_MODULE_PATHNone DEFAULT_FROM_EMAIL'webmaster@localhost' MEDIA_URL'' DATETIME_FORMAT'N j, Y, P' TEMPLATE_DIRS() DISALLOWED_USER_AGENTS() ALLOWED_INCLUDE_ROOTS() LOGGING{} SHORT_DATE_FORMAT'm/d/Y' TEST_RUNNER'django.test.runner.DiscoverRunner' CACHE_MIDDLEWARE_KEY_PREFIXu'**' TIME_ZONE'UTC' FILE_UPLOAD_MAX_MEMORY_SIZE2621440 EMAIL_BACKEND'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_SSLFalse TEMPLATE_CONTEXT_PROCESSORS('django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages') SESSION_COOKIE_AGE1209600 SETTINGS_MODULE'connectedin.settings' USE_ETAGSFalse LANGUAGES_BIDI('he', 'ar', 'fa', 'ur') FILE_UPLOAD_TEMP_DIRNone CSRF_COOKIE_AGE31449600 STATIC_URL'/static/' EMAIL_PORT25 USE_TZTrue SHORT_DATETIME_FORMAT'm/d/Y P' PASSWORD_HASHERSu'**' ABSOLUTE_URL_OVERRIDES{} LANGUAGE_COOKIE_PATH'/' CACHE_MIDDLEWARE_SECONDS600 CSRF_COOKIE_HTTPONLYFalse DATETIME_INPUT_FORMATS('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y') EMAIL_HOST_USER'' PROFANITIES_LISTu'**'

5 respostas

Você criou a app perfis dentro de connectedin?

A pagina continua apresentando o mesmo erro

segue a estrutura de diretório criada:

Pasta de C:\Caca\Alura\Python\Django\projetoDjango 30/03/2015 17:16

connectedin

Pasta de C:\Caca\Alura\Python\Django\projetoDjango\connectedin 28/02/2017 11:06

connectedin 24/03/2015 15:58 36.864 db.sqlite3 24/03/2015 15:58 254 manage.py 28/02/2017 10:57 perfis

Pasta de C:\Caca\Alura\Python\Django\projetoDjango\connectedin\connectedin 24/03/2015 16:08 2.070 settings.py 28/02/2017 10:39 2.342 settings.pyc 28/02/2017 11:02 318 urls.py 28/02/2017 11:06 457 urls.pyc 24/03/2015 15:58 397 wsgi.py 28/02/2017 10:39 629 wsgi.pyc 24/03/2015 15:58 0 init.py 28/02/2017 10:39 164 init.pyc

Pasta de C:\Caca\Alura\Python\Django\projetoDjango\connectedin\perfis 24/03/2015 16:06 63 admin.py 28/02/2017 10:39 216 admin.pyc 28/02/2017 10:39

migrations 24/03/2015 16:06 57 models.py 28/02/2017 10:39 213 models.pyc 28/02/2017 10:55 templates 24/03/2015 16:06 60 tests.py 28/02/2017 10:06 154 urls.py 28/02/2017 10:34 412 urls.pyc 28/02/2017 10:54 189 views.py 24/03/2015 16:06 0 init.py 28/02/2017 10:39 159 init.pyc

Pasta de C:\Caca\Alura\Python\Django\projetoDjango\connectedin\perfis\migrations 24/03/2015 16:06 0 init.py 28/02/2017 10:39 170 init.pyc

Pasta de C:\Caca\Alura\Python\Django\projetoDjango\connectedin\perfis\templates

28/02/2017 10:24 259 index.html

Então. Continua dizendo que perfis não existe. Sugiro começar do zero. Pode ficar tranquilo que mais de 300 alunos já passaram dessa parte sem problema.

Aguardo seu retorno.

Estou começando do zero, e o arquivo views, dentro do diretório perfis, esta apresentando este erro: [pylint] C0111:Missing module docstring [pylint] W0611:Unused render imported from django.shortcuts django.shortcuts

from django.shortcuts import render

# Create your views here.
solução!

Qual versão do Django você esta usando?