[Tutor] HttpResponse error

2009-10-26 Thread Vincent Jones
SyntaxError at /

("'return' outside function",
('c:\\Users\\Vincent\\Documents\\django_bookmarks\\..\\django_bookmarks\\boo
kmarks\\views.py', 15, None, 'return HttpResponse(output)\n'))

 

 

As you can tell I am very new to this I am realizing that it is very
important that indention and syntax is very important but i don't understand
why I am getting this error This is the the original script in the views.py

 

from django.http import HttpResponse

def main_page(request) :

   output = '''

  

 %s

 

%s%s

 

  

''' % (

  'Django Bookmarks',

  'Welcome to Django Bookmarks',

  'Where you can store and share bookmarks!'

)

return HttpResponse(output)

 

And this (below is the error)

 

Environment:

 

Request Method: GET

Request URL: http://127.0.0.1:8000/

Django Version: 1.1.1

Python Version: 2.6.1

Installed Applications:

['django.contrib.auth',

 'django.contrib.contenttypes',

 'django.contrib.sessions',

 'django.contrib.sites']

Installed Middleware:

('django.middleware.common.CommonMiddleware',

 'django.contrib.sessions.middleware.SessionMiddleware',

 'django.contrib.auth.middleware.AuthenticationMiddleware')

 

 

Traceback:

File "C:\Python26\Lib\site-packages\django\core\handlers\base.py" in
get_response

  83. request.path_info)

File "C:\Python26\Lib\site-packages\django\core\urlresolvers.py" in resolve

  216. for pattern in self.url_patterns:

File "C:\Python26\Lib\site-packages\django\core\urlresolvers.py" in
_get_url_patterns

  245. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)

File "C:\Python26\Lib\site-packages\django\core\urlresolvers.py" in
_get_urlconf_module

  240. self._urlconf_module = import_module(self.urlconf_name)

File "C:\Python26\Lib\site-packages\django\utils\importlib.py" in
import_module

  35. __import__(name)

File
"C:\Users\Vincent\Documents\django_bookmarks\..\django_bookmarks\urls.py" in


  2. from bookmarks.views import *

 

Exception Type: SyntaxError at /

Exception Value: ("'return' outside function",
('c:\\Users\\Vincent\\Documents\\django_bookmarks\\..\\django_bookmarks\\boo
kmarks\\views.py', 15, None, 'return HttpResponse(output)\n'))

 

 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Error

2009-10-27 Thread Vincent Jones
I created database using the 'python manage.py sycdb'

then proceeded to 'python manage.py sql bookmarks'

and i receive this error:
Error: App with label bookmarks could not be found. Are you sure your
INSTALLED_APPS settings is correct?

I go to Settings py and the INSTALLED_APPS is 'django_bookmarks.bookmarks',

I also looked in the directory 'django_bookmarks' and there is a directory
bookmarks within it so what am i doing wrong?
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor