Buzzy Documentation. Release 0. Sebastian Pawluś

Similar documents
termite Release 0.0.2

Flask-Genshi Documentation

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

A Sample Approach to your Project

CIS192 Python Programming

Python web frameworks

HOW TO FLASK. And a very short intro to web development and databases

LECTURE 14. Web Frameworks

CSE 115. Introduction to Computer Science I

LECTURE 14. Web Frameworks

Socrates Documentation

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. TurboGears

Building Web Applications

django-messages Documentation

Signals Documentation

29-27 May 2013 CERN WEB FRAMEWORKS. Adrian Mönnich

Django-CSP Documentation

Django Synctool Documentation

django-dynamic-db-router Documentation

The State of Python. and the web. Armin Ronacher

Masters in Web Development

Building a Django Twilio Programmable Chat Application

Bricks Documentation. Release 1.0. Germano Guerrini

Building a Python Flask Website A beginner-friendly guide

simpleai Documentation

Web Scraping with Python

EXPERIENCES MOVING FROM DJANGO TO FLASK

Without Django. applying django principles to non django projects

Python Schema Generator Documentation

Flask Slither Documentation

nacelle Documentation

CIS192 Python Programming

Server-Side Web Programming: Python (Part 2) Copyright 2017 by Robert M. Dondero, Ph.D Princeton University

Tissu for Fabric Documentation

The Impact of Django. Armin Ronacher. djangocon europe 2011

Chris Calloway for Triangle Python Users Group at Caktus Group December 14, 2017

web.py Tutorial Tom Kelliher, CS 317 This tutorial is the tutorial from the web.py web site, with a few revisions for our local environment.

welcome to BOILERCAMP HOW TO WEB DEV

micawber Documentation

APIs and API Design with Python

Dodo Commands Documentation

Flask-Misaka Documentation

CS1520 Recitation: Security in Flask

invenio-formatter Documentation

django-gollum Documentation

Flask-Twilio Documentation

Nbconvert Refactor Final 1.0

Django. Jinja2. Aymeric Augustin DjangoCong 2016

Python State Machine Documentation

Django-Select2 Documentation. Nirupam Biswas

Flask Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : May, More documents are freely available at PythonDSP

django-debreach Documentation

Let's talk about QRadar Apps: Development & Troubleshooting IBM SECURITY SUPPORT OPEN MIC

Building Scalable Web Apps with Python and Google Cloud Platform. Dan Sanderson, April 2015

Tornado-Babel Documentation

django-telegram-bot Documentation

Flask-Testing Documentation

Start of the site or web application development

IoT Relay Documentation

django-dajax Documentation

Managing Dependencies and Runtime Security. ActiveState Deminar

Lecture 4. Ruby on Rails 1 / 49

Brief Contents. Acknowledgments... xv. Introduction Chapter 1: Starting Your Project Chapter 2: Modules, Libraries, and Frameworks...

Django-frontend-notification Documentation

Quick Installation Guide: TC-Python

Server-side Development using Python and SQL

Client-Server Communication

Django Web Framework: A Comprehensive Introduction and Step by Step Installation

Microservices using Python and Oracle. Arup Nanda Longtime Oracle DBA And Explorer of New Things

Flask-Sitemap Documentation

Flask-Assets Documentation

virtualenvwrapper Documentation

Technical Note: On The Usage and Development of the AWAKE Web Server and Web Applications

Qiufeng Zhu Advanced User Interface Spring 2017

XStatic Documentation

Flask-Plugins Documentation

Introduction. HPC Python. Cyrus Proctor January 23th, 2015

mongodb-tornado-angular Documentation

Lecture 10(-ish) Web [Application] Frameworks

Technology modeling. Ralf Lämmel Software Languages Team University of Koblenz-Landau

Briefcase Documentation

Web based testing: Chucklist and Selenium

The Pyramid Web Application Development Framework

Reading How the Web Works

The RestructuredText Book Documentation

python-docker-machine Documentation

IERG 4080 Building Scalable Internet-based Services

Now go to bash and type the command ls to list files. The unix command unzip <filename> unzips a file.

Tomasz Szumlak WFiIS AGH 23/10/2017, Kraków

AirBespoke Inventory Tracking System

jarvis Documentation Release Francois Lagunas

Tornado-Babel Documentation

pyramid_assetmutator Documentation

Flask Web Development Course Catalog

django-reinhardt Documentation

web frameworks design comparison draft - please help me improve it focus on Model-View-Controller frameworks

Briefcase Documentation

Implementation of Synchronizers

Python State Machine Documentation

Mantis STIX Importer Documentation

Transcription:

Buzzy Documentation Release 0 Sebastian Pawluś November 10, 2015

Contents 1 Install 3 2 Quick Start 5 3 Renderers 7 4 Settings 9 5 Commands 11 6 Why yield 13 7 Source Code 15 i

ii

Buzzy Documentation, Release 0 Low level static page generator, with simple API! Why to use static sites generator? There are many cases, when your website will be static and using dynamic pages framework like Django, Ruby on Rails, Flask, Sinatra would be a bit of overhead. Why to write yet another static website generator? Not really sure, yet! Contents 1

Buzzy Documentation, Release 0 2 Contents

CHAPTER 1 Install Buzzy currently runs only Python 2.7.x and earlier versions of Python are not supported and Python 3 was not tested yet. You can install it from PyPi, by simply pip: $ pip install buzzy A recommended approach would be to create a virtual environment for buzzy project via virtualenv before installing it. 3

Buzzy Documentation, Release 0 4 Chapter 1. Install

CHAPTER 2 Quick Start Create a regular python file, copy paste the content presented below. import buzzy class StaticSite(buzzy.Base): @buzzy.register def thing(self): yield buzzy.render.content("hello world", "index.html") if name == " main ": StaticSite() Each render function created with buzzy needs to be decorated with register. This way buzzy will know which method in class should be called during the build process. $ python project.py build 2014-03-01 20:54:55,599 - StaticSite - INFO - build generated Now you should have content inside your build directory, which will be called _build. $ ls _build index.html $ cat _build/index.html Hello world You should see there one file index.html, and the content of this file will be Hello world. $ python project.py server 2014-03-01 20:54:55,599 - StaticSite - INFO - build generated 2014-03-01 20:54:55,600 - StaticSite - INFO - serving at port 8000 Go to your browser to http://127.0.0.1:8000/, done! 5

Buzzy Documentation, Release 0 6 Chapter 2. Quick Start

CHAPTER 3 Renderers buzzy.render.content(content, target_file) A renderer class to create a file from a content. Parameters content content to put inside he file target_file name of the destination file @buzzy.register def view(self): yield buzzy.render.content("index.html", "hello world") buzzy.render.template(template, target_file, **context) A renderer class to render file from a template. jinja2 package is required Parameters template jinja2 template located in the TEMPLATE_DIR target_file name of the destination file **context as many named parameters as needed, all will be put as a context inside the template @buzzy.register def view(self): yield buzzy.render.template("index.html", "index.tpl", text="hello world") buzzy.render.markdown(source, target_file) A renderer class to render file from a markdown markup. markdown package is required Parameters target_file name of the destination file source for source of the markup file @buzzy.register def view(self): yield buzzy.render.markdown("index.html", "index.md") 7

Buzzy Documentation, Release 0 8 Chapter 3. Renderers

CHAPTER 4 Settings BUILD_DIR, default = _build Build directory, where static page will be generated after executing build method. INCLUDE, default = [] List of files and directories that will be copy over to the build directory without any modifications. TEMPLATES_DIR, default = templates Templates directory, jinja2 base template directory used with render.template. SERVER_PORT, default = 8000 Developer server port, from which will page will be server after executing server method. WATCH_EXCLUDE, default = [.git*,.hg*, *.orig ] List of files to be excluded from watch process. When watch command is called, the build directory will be reload every time when page got changed. This setting prevents from calling rebuild for some files. The BUILD_DIR is will be excluded as well. 9

Buzzy Documentation, Release 0 10 Chapter 4. Settings

CHAPTER 5 Commands build Regenerates the content inside BUILD_DIR server Runs developemnt server. It will watch development directory, if files inside will get changed it will trigger build command. Custom command By using @buzzy.command decorator you can register your own command @buzzy.command def mycommand(self): deploy_site() $ python project.py mycommand 11

Buzzy Documentation, Release 0 12 Chapter 5. Commands

CHAPTER 6 Why yield There are three main reasons why to use yield here: yield is cool, and is overly underrated as python mechanism, render function may call yield many times, which means that one function may generate more than one file, yield is memory efficient, we are operating here on file contents in memory, yield will reduce some pain here. 13

Buzzy Documentation, Release 0 14 Chapter 6. Why yield

CHAPTER 7 Source Code https://github.com/xando/buzzy 15

Buzzy Documentation, Release 0 16 Chapter 7. Source Code

Index B buzzy.render.content() (built-in function), 7 buzzy.render.markdown() (built-in function), 7 buzzy.render.template() (built-in function), 7 17