In web2py you do not need to use the admin interface. It's not obligatory. Here's how you create a simple application from scratch:
wget http://web2py.com/examples/static/web2py_src.zip unzip web2py_src.zip cd web2py/applications mkdir myapp cp -r ../welcome/* ./
Advanced Change application
emacs controllers/default.py emacs models/db.py emacs views/default/index.html ...
(you can delete everything that you do not need). Now run web2py and try
cd ../.. python web2py.py -i 127.0.0.1 -p 8000 -a chooseapassword & wget http://127.0.0.1:8000/myapp/default/index.html
When editing the controller /default.py you have a controller like
def index(): the_input = request.vars
You can return a dict (will be parsed by the view with the same name as the action) or a string (the actual content of the page). For instance:
def index(): name = request.vars.name or 'anonymous' return "hello "+name
and call
wget http://127.0.0.1:8000/myapp/default/index?name=Max
returns
'hello Max'
/ myapp / default / index? name = Max calls the index of the function, the default.py controller of the application in the applications of the / myapp / folder, and passes name = Max to request.vars.name = 'Max'.
source share