https://github.com/multiversecoder/pug4py
Use Pug.js within any python framework
https://github.com/multiversecoder/pug4py
bottle django flask frontend nodejs pug pyramid python python-framework python3 template-engine turbogears web2py
Last synced: 7 months ago
JSON representation
Use Pug.js within any python framework
- Host: GitHub
- URL: https://github.com/multiversecoder/pug4py
- Owner: multiversecoder
- License: mit
- Created: 2019-11-14T19:24:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T16:50:21.000Z (almost 4 years ago)
- Last Synced: 2024-11-14T14:43:25.005Z (7 months ago)
- Topics: bottle, django, flask, frontend, nodejs, pug, pyramid, python, python-framework, python3, template-engine, turbogears, web2py
- Language: Python
- Size: 74.2 KB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pug4Py - Pug Templates for Python
What is Pug (Pug.js)?
---------------------Pug is a tool similar to HAML (or better its evolution) that allows you to abstract the html syntax, preventing errors and improving the speed of frontend development.
Check pug.js on:
[Pugjs.org](https://pugjs.org/api/getting-started.html)
What is pug4py?
-------------Pug4Py is a simple script that allows you to use all the functions of Pug (NodeJs)
in any python framework with the addition that you can also use the
mako syntax (a popular and fast template engine for python).Here is a small example of usage:
```python
from pug4py.pug import Pugpug = Pug("pug")
def say_hello():
return "Hello World"pug.render("example.pug", say_hello=say_hello, year="2019", author="https://github.com/multiversecoder/pug4py")
```
Requirements
------------You need Python 3.7 or later to run pug4py, node v12.10.0 and yarn
In Ubuntu, Mint and Debian you can install Requirements like this:
$ apt-get install python3 python3-pip
$ curl -sL https://deb.nodesource.com/setup_12.10.0 | sudo -E bash -
$ apt update && apt install nodejs
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ apt update && apt install yarnFor fedora
$ dnf install python3 python3-pip
$ curl -sL https://deb.nodesource.com/setup_12.10.0 | sudo -E bash -
$ dnf update && dnf install nodejs
$ curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
$ dnf install yarnFor other systems
- Install Python3
- Install Nodejs
- Install YarnPug Installation
-----------------Pug will be installed implicitly when the Pug class is initialized and installed inside the pug4py package directory
Quick start
-----------pug4py can be installed using pip:
$ python3 -m pip install -U pug4py
or:
$ pip install pug4py
for install pug4py from source:
$ git clone https://github.com/multiversecoder/pug4py
$ cd ./pug4py
$ pip install .Development status
------------------pug4py is beta software, but it has already been used in production and it has an extensive test suite.