How are you trying to access your application, what URL are you using?

I don't think you have an error anywhere really. Assuming you're doing this 
on the localhost and using the rocket web server that comes with web2py, 
try:

http://127.0.0.1:8000/TestPostgres/default/index

BTW, if you look at the contents of your postgre database, you should see 
some tables web2py created for you.

Regards,
Ales


On Saturday, March 9, 2013 2:56:38 PM UTC+1, BlueShadow wrote:
>
> db.py
>
> # -*- coding: utf-8 -*-
>
> #########################################################################
> ## This scaffolding model makes your app work on Google App Engine too
> ## File is released under public domain and you can use without limitations
> #########################################################################
>
> ## if SSL/HTTPS is properly configured and you want all HTTP requests to
> ## be redirected to HTTPS, uncomment the line below:
> # request.requires_https()
>
> if not request.env.web2py_runtime_gae:
>     ## if NOT running on Google App Engine use SQLite or other DB
>     db = DAL("postgres://dbuser:testpw@localhost:5432/testdb")
> else:
>     ## connect to Google BigTable (optional 
> 'google:datastore://namespace')
>     db = DAL('google:datastore')
>     ## store sessions and tickets there
>     session.connect(request, response, db=db)
>     ## or store session in Memcache, Redis, etc.
>     ## from gluon.contrib.memdb import MEMDB
>     ## from google.appengine.api.memcache import Client
>     ## session.connect(request, response, db = MEMDB(Client()))
>
> ## by default give a view/generic.extension to all actions from localhost
> ## none otherwise. a pattern can be 'controller/function.extension'
> response.generic_patterns = ['*'] if request.is_local else []
> ## (optional) optimize handling of static files
> # response.optimize_css = 'concat,minify,inline'
> # response.optimize_js = 'concat,minify,inline'
>
> #########################################################################
> ## Here is sample code if you need for
> ## - email capabilities
> ## - authentication (registration, login, logout, ... )
> ## - authorization (role based authorization)
> ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
> ## - old style crud actions
> ## (more options discussed in gluon/tools.py)
> #########################################################################
>
> from gluon.tools import Auth, Crud, Service, PluginManager, 
> prettydate,psycopg2
> auth = Auth(db)
> crud, service, plugins = Crud(db), Service(), PluginManager()
>
> ## create all tables needed by auth if not custom tables
> auth.define_tables(username=False, signature=False)
>
> ## configure email
> mail = auth.settings.mailer
> mail.settings.server = 'logging' or 'smtp.gmail.com:587'
> mail.settings.sender = 'you<at>""""had to change it because of google 
> groups"""gmail.com'
> mail.settings.login = 'username:password'
>
> ## configure auth policy
> auth.settings.registration_requires_verification = False
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_requires_verification = True
>
> ## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
> ## register with janrain.com, write your domain:api_key in 
> private/janrain.key
> from gluon.contrib.login_methods.rpx_account import use_janrain
> use_janrain(auth, filename='private/janrain.key')
>
> #########################################################################
> ## Define your tables below (or better in another model file) for example
> ##
> ## >>> db.define_table('mytable',Field('myfield','string'))
> ##
> ## Fields can be 'string','text','password','integer','double','boolean'
> ##       'date','time','datetime','blob','upload', 'reference TABLENAME'
> ## There is an implicit 'id integer autoincrement' field
> ## Consult manual for more options, validators, etc.
> ##
> ## More API examples for controllers:
> ##
> ## >>> db.mytable.insert(myfield='value')
> ## >>> rows=db(db.mytable.myfield=='value').select(db.mytable.ALL)
> ## >>> for row in rows: print row.id, row.myfield
> #########################################################################
>
> ## after defining tables, uncomment below to enable auditing
> # auth.enable_record_versioning(db)
>
>
> default.py
> # -*- coding: utf-8 -*-
> # this file is released under public domain and you can use without 
> limitations
>
> #########################################################################
> ## This is a samples controller
> ## - index is the default action of any application
> ## - user is required for authentication and authorization
> ## - download is for downloading files uploaded in the db (does streaming)
> ## - call exposes all registered services (none by default)
> #########################################################################
>
>
> def index():
>     """
>     example action using the internationalization operator T and flash
>     rendered by views/default/index.html or views/generic.html
>
>     if you need a simple wiki simple replace the two lines below with:
>     return auth.wiki()
>     """
>     response.flash = T("Welcome to web2py!")
>     return dict(message=T('Hello World'))
>
>
> def user():
>     """
>     exposes:
>     http://..../[app]/default/user/login
>     http://..../[app]/default/user/logout
>     http://..../[app]/default/user/register
>     http://..../[app]/default/user/profile
>     http://..../[app]/default/user/retrieve_password
>     http://..../[app]/default/user/change_password
>     use @auth.requires_login()
>         @auth.requires_membership('group name')
>         @auth.requires_permission('read','table name',record_id)
>     to decorate functions that need access control
>     """
>     return dict(form=auth())
>
>
> def download():
>     """
>     allows downloading of uploaded files
>     http://..../[app]/default/download/[filename]
>     """
>     return response.download(request, db)
>
>
> def call():
>     """
>     exposes services. for example:
>     http://..../[app]/default/call/jsonrpc
>     decorate with @services.jsonrpc the functions to expose
>     supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
>     """
>     return service()
>
>
> @auth.requires_signature()
> def data():
>     """
>     http://..../[app]/default/data/tables
>     http://..../[app]/default/data/create/[table]
>     http://..../[app]/default/data/read/[table]/[id]
>     http://..../[app]/default/data/update/[table]/[id]
>     http://..../[app]/default/data/delete/[table]/[id]
>     http://..../[app]/default/data/select/[table]
>     http://..../[app]/default/data/search/[table]
>     but URLs must be signed, i.e. linked with
>       A('table',_href=URL('data/tables',user_signature=True))
>     or with the signed load operator
>       
> LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
>     """
>     return dict(form=crud())
>
>
>
> default/index.html
> {{left_sidebar_enabled,right_sidebar_enabled=False,('message' in globals
> ())}}
> {{extend 'layout.html'}}
>
> {{if 'message' in globals():}}
> <h3>{{=message}}</h3>
>
> <h4>{{=T('How did you get here?')}}</h4>
> <ol>
>   <li>{{=T('You are successfully running web2py')}}</li>
>   <li>{{=XML(T('You visited the url %s', A(request.env.path_info,_href=
> request.env.path_info)))}}</li>
>   <li>{{=XML(T('Which called the function %s located in the file %s',
>              (A(request.function+'()',_href='#'),
>               A(
> 'web2py/applications/%(application)s/controllers/%(controller)s.py'%
> request,
>                _href=URL('admin','default','peek', args=(request.
> application,'controllers',request.controller+'.py'))))))}}</li>
>   <li>{{=XML(T('The output of the file is a dictionary that was rendered 
> by the view %s',
>            A(
> 'web2py/applications/%(application)s/views/%(controller)s/index.html'%
> request,
>            _href=URL('admin','default','peek',args=(request.application,
> 'views',request.controller,'index.html')))))}}</li>
>   <li>{{=T('You can modify this application and adapt it to your needs'
> )}}</li>
> </ol>
> {{elif 'content' in globals():}}
> {{=content}}
> {{else:}}
> {{=BEAUTIFY(response._vars)}}
> {{pass}}
>
> {{block right_sidebar}}
> {{=A(T("Administrative Interface"), _href=URL('admin','default','index'), 
> _class='btn',
>      _style='margin-top: 1em;')}}
> <h6>{{=T("Don't know what to do?")}}</h6>
> <ul>
>   <li>{{=A(T("Online examples"), _href=URL('examples','default','index'
> ))}}</li>
>   <li><a href="http://web2py.com";>web2py.com</a></li>
>   <li><a href="http://web2py.com/book";>{{=T('Documentation')}}</a></li>
> </ul>
> {{end}}
>
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to