Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d58cc5f
commit 0e5bba4
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
layout: default | ||
title: Auto Application | ||
--- | ||
|
||
# Auto Application | ||
|
||
Autre langages : [english](/docs/0.3/apps/auto) | ... | ||
|
||
L'auto application agit comme la [basic application](/docs/0.3/apps/basic/fr), seulement il ne nécessite pas un mapping d'url pour être créé. Le mapping est dérivé des noms de classe (utilisant les métaclasses). Dans sa forme la plus basique : | ||
|
||
## Exemple | ||
|
||
app = web.auto_application() | ||
|
||
class hello(app.page): | ||
def GET(self): | ||
return "hello, world!" | ||
if __name__ == '__main__': | ||
app.run() # goto http://hostname:8080/hello | ||
|
||
|
||
|
||
Vous pouvez également modifier le chemin par défaut (qui est le nom de la classe) en définissant une variable de classe "path". Voir ci-dessous: | ||
|
||
## Exemple: | ||
|
||
app = web.auto_application() | ||
|
||
class hello(app.page): | ||
path = "/foobar" | ||
def GET(self): | ||
return "hello, world!" | ||
|
||
if __name__ == '__main__': | ||
app.run() # goto http://hostname:8080/foobar |