O que é py4web?
PY4WEB is a web framework for rapid development of efficient database driven web applications. It is an evolution of the popular web2py framework, but much faster and slicker. Its internal design has been much simplified compared to web2py.
PY4WEB can be seen as a competitor of other frameworks like Django or Flask, and it can indeed serve the same purpose. Yet PY4WEB aims to provide a larger feature set out of the box and to reduce the development time of new apps.
From a historical perspective, our story starts in 2007 when web2py was first released. web2py was designed to provide an all-inclusive solution for web development: one zip file containing the Python interpreter, the framework, a web based IDE, and a collection of battle-tested packages that work well together. In many ways web2py has been immensely successful. Web2py succeeded in providing a low barrier of entry for new developers, a very secure development platform, and remains backwards compatible until today.
Web2py always suffered from one problem: its monolithic design. The most experienced Python developers did not understand how to use its components outside of the framework and how to use third party components within the framework. We thought of web2py as a perfect tool that did not have to be broken into pieces because that would compromise its security. It turned out that we were wrong, and playing well with others is important. Hence, since 2015 we worked on three fronts:
Nós portado web2py para Python 3.
Nós quebramos web2py em módulos que podem ser usados de forma independente.
Nós reagrupados alguns desses módulos em uma nova e mais modular quadro … PY4WEB.
PY4WEB is more than a repackaging. It is a complete redesign. It uses some of the web2py modules, but not all of them. In some cases, it uses other and better modules. Some functionality was removed and some was added. We tried to preserve most of the syntax and features that experienced web2py users loved.
Here is a more explicit list (see De web2py para py4web for more details if you come from web2py):
PY4WEB, ao contrário web2py, requer Python 3.
PY4WEB, unlike web2py, can be installed using pip, and its dependencies are managed using requirements.txt.
PY4WEB apps are regular Python modules. This is very different from web2py. In particular, we ditched the custom importer, and we rely now exclusively on the regular Python import mechanism.
PY4WEB, como web2py, podem servir múltiplas aplicações concorrentemente, enquanto as aplicações são submódulos do módulo de aplicações.
PY4WEB, unlike web2py, is based on ombott (a reduced and faster spin-off of Bottle) and in particular uses a Bottle-compatible request object and routing mechanism.
PY4WEB, unlike web2py, does not create a new environment at every request. It introduces the concept of fixtures to explicitly declare which objects need to be (re)initialized when a new http request arrives or needs cleanup when completed. This makes it much faster than web2py.
PY4WEB, has a new session object which, like web2py’s, provides strong security and encryption of the session data, but sessions are no longer stored in the file system - which created performance issues. It provides sessions in cookies, in redis, in memcache, or optionally in database. We also limited session data to objects that are json serializable.
PY4WEB, como web2py, tem um built-in sistema de bilhética, mas, ao contrário web2py, este sistema é global e não por aplicação. Os bilhetes já não são armazenados no sistema de arquivos com os aplicativos individuais. Eles são armazenados em um único banco de dados.
PY4WEB, like web2py, is based on pydal but leverages some new features of pydal (RESTAPI).
PY4WEB, como web2py, usa a linguagem de template yatl mas o padrão é suportes delimitadores quadrados para evitar conflitos com modelo quadros JS, como Vue.js e angularjs. Yatl inclui um subconjunto dos ajudantes web2py.
PY4WEB, ao contrário web2py, usa a biblioteca pluralização para a internacionalização. Na prática, isso expõe um objeto T muito semelhante ao do web2py T mas fornece melhor cache e capacidades pluralização mais flexíveis.
PY4WEB vem com um painel APP que administrador substitui do web2py. Esta é uma IDE web para carregar / gestão / aplicativos de edição.
Painel de PY4WEB inclui uma interface de banco de dados baseado na web. Isto substitui a funcionalidade AppAdmin de web2py.
PY4WEB comes with Form and Grid objects that are similar to web2py’s SQLFORM and SQLFORM.grid.
PY4WEB vem com um objeto Auth que substitui o web2py. É mais modular e mais fácil de estender. Fora da caixa, ele fornece a funcionalidade básica do registo, login, logout, de alteração de senha, solicitação de alteração de senha, editar o perfil, bem como a integração com o PAM, SAML2, LDAP, OAUTH2 (google, facebook e Twitter).
PY4WEB leverages PyDAL’s new tags functionality to tag users with groups, search users by groups, and apply permissions based on membership.
PY4WEB vem com com alguns componentes personalizados Vue.js projetados para interagir com o PyDAL RESTAPI, e com PY4WEB em geral. Essas APIs são projetados para permitir que o servidor para definir políticas sobre quais operações um cliente é permitido para executar, mas dá a flexibilidade cliente dentro dessas restrições. Os dois principais componentes são mtable (que fornece uma interface baseada na web para o banco de dados semelhante à grade do web2py) e auth (uma interface personalizável à API Auth).
O objetivo do PY4WEB é e continua a ser o mesmo que web2py de: para o desenvolvimento web make fácil e acessível, enquanto a produção de aplicações que são rápidos e seguros.
Acknowledgments
Many thanks to everyone who has contributed to the project, and especially:
Sam de Alfaro (logo design)
Special thanks to Sam de Alfaro, who designed the official logo of py4web. We friendly call the logo «Axel the axolotl»: it magically represents the sense of kindness and inclusion. We believe it’s the cornerstone of our growing community.