[PYTHON] web2py memo: Hello World

First install

http://www.web2py.com/init/default/download

After that

python web2py.py -a 'password' -i 127.0.0.1 -p 8000

Application creation

python web2py.py -S appName

appName / views / default / index.html etc. are created

Hello World: appName / controllers / default.py

def index():
   return "Hello,World!"

If you start the server and check it, it is certainly done (URI is ... / index)

To embed and display in a template

def index():
   return dict(message="Hello!")

Embed the script in the template

<body>
   {{for i in range(3):}}
      {{=message}}<br/>       <!-- {{=value}}でvalueをHTMLに出力 -->
   {{pass}}                   <!--The dictionary element passed by the controller function can be used as a variable-->
</body>

Recommended Posts

web2py memo: Hello World
Hello world
Hello World in Flask [Appropriate memo]
Pymacs hello world
cython hello world
hello world with ctypes
RabbitMQ Tutorial 1 ("Hello World!")
Hello, World with Docker
Hello World on Django
Django's first Hello World
Hello world with flask
Draw hello world with mod_wsgi
Hello World with Flask + Hamlish
Until hello world with zappa
Programming language in "Hello World"
Hello World in GO language
Hello World (beginners) on Django
Python starting with Hello world!
Let's do "Hello World" in 40 languages! !!
Hello, world! With virtual CAN communication
Introduction to TensorFlow --Hello World Edition
Hello world! (Minimum Viable Block Chain)
[Note] Hello world output with python
cout << "Hello, World! \ N" in python
Code: 2 "Hello World" in "Choregraphe-Python script"
Hello World! By QPython with Braincrash
Python #Hello World for super beginners
Introduction to Ansible Part 1'Hello World !!'
[Python] Web application from 0! Hands-on (2) -Hello World-
Hello World and face detection with opencv-python 4.2
Hello World with Raspberry Pi + Minecraft Pi Edition
How to build Hello, World on #Nix
Hello world instead of localhost in Django
(For myself) Django_1 (Basic / Hello World / Template)
Flask tutorial (from installation to hello world)
How to display Hello world in python
Hello World! By QPython with Brainfu * k