Reputation: 51
I tried writing the hello world program in django but i get didn't get the expected outcome. Please help- 2nd day stuck here. My Python version 2.7. Django 1.6.2
Directory list:
1. Code in Views file
from django.http import HttpResponse
def hello(request):
return HttpResponse(“hello world”)
2. Code in urls file
from django.conf.urls import patterns, include, url
from mysite.views import hello
#from django.contrib import admin
#admin.autodiscover()
#urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
#url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'mysite.views.hello’, name=‘hello’)
)
SyntaxError at "":
Exception Value:
Non-ASCII character '\xe2' in file /Users/**/**/djcode/mysite/mysite/urls.py on line 16, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details (urls.py, line 16)
[please note: asterisk used to hide the path above]
Upvotes: 4
Views: 547
Reputation: 888
You are using different characters:
url(r'^$', 'mysite.views.hello’, name=‘hello’)
should be:
url(r'^$', 'mysite.views.hello', name='hello')
so to clarify ’
should be '
in that line of code.
Upvotes: 4