Baka framework built top pyramid
Project description
Baka Framework
Baka Framework adalah web application framework yang menggunakan core wsgi dari Pyramid.
Penggunaan
Kamu dapat menggunakan baka framework dengan sangat sederhana seperti route handler function, misalnya.
from baka import Baka
from baka.log import log
app = Baka(__name__)
# route method
@app.route('/')
def index_page(req):
log.info(req)
return {'Baka': 'Hello World!'}
@app.route('/home')
def home_page(req):
log.info(req)
return {'Route': 'home'}
# root resources routes
class ResourcesPage(object):
def __init__(self, request):
self._name = 'Resource Page'
log.info(request.params)
# GET resource method
@ResourcesPage.GET()
def resources_page_get(root, request):
return {
'hello': 'Get Hello resources from Page root %s ' % page._name
}
Modular Package / Folder
Dengan penggunakan baka.include(callable), kamu dapat menggabungkan module terpisah dari beberapa file didalam package module.
contoh file: testbaka/view_user.py
from .app import app
@app.route('/users')
def user(req):
return {'users': 'all data'}
def includeme(config):
pass
file: testbaka/app.py
from baka import Baka
from baka.log import log
app = Baka(__name__)
app.include('testbaka.view_user') # include module dari file view_user.py
@app.route('/')
def index_page(req):
log.info(req)
return {'Baka': 'Hello World!'}
@app.route('/home')
def home_page(req):
log.info(req)
return {'Route': 'home'}
App Folder
Untuk Struktur Application Folder optional
root
package (AppBaka)
config ``optional, Baka(__name__, config_schema=True)``
config.yaml # digunakan for baka default configuration
__init__.py # the code goes in here
wsgi.py # for running in wsgi container e.g gunicorn
run.py # running development server
Default Configuration Baka from config.yaml
package: AppBaka # mandatory for root package
version: 0.1.0 # optional
baka:
debug_all: True # mandatory for debug environment
meta:
version: 0.1.0 # mandatory for json response version
WSGI Container Application Server wsgi.py
# -*- coding: utf-8 -*-
"""
WSGI Application Server
~~~~~~~~~
:author: nanang.jobs@gmail.com
:copyright: (c) 2017 by Nanang Suryadi.
:license: BSD, see LICENSE for more details.
wsgi.py
"""
from . import app
application = app
Running in Development mode run.py
# -*- coding: utf-8 -*-
"""
:author: nanang.jobs@gmail.com
:copyright: (c) 2017 by Nanang Suryadi.
:license: BSD, see LICENSE for more details.
run.py.py
"""
from . import app
app.run(use_reloader=True)
Install
pip install baka
Running
Development mode
python run.py
Production mode with Gunicorn
gunicorn -w 1 -b 0.0.0.0:5000 AppBaka.wsgi
Contoh Aplikasi
git clone https://github.com/baka-framework/baka.git
cd examples
python3 -m venv env
source env/bin/active
pip install baka
python run.py
Saran dan Kontribusi
Qoutes from heroes.
“ Learning without thinking is useless, but thinking without learning is very dangerous! ”
-― Sukarno, Di Bawah Bendera Revolusi : Jilid 1
“ Apabila dalam diri seseorang masih ada rasa malu dan takut untuk berbuat suatu kebaikan, maka jaminan bagi orang tersebut adalah tidak akan bertemunya ia dengan kemajuan selangkah pun ”
—Sukarno
“ Kurang cerdas dapat diperbaiki dengan belajar, kurang cakap dapat dihilangkan dengan pengalaman. Namun tidak jujur sulit diperbaiki. ”
—Bung Hatta
“ Keberanian bukan berarti tidak takut, keberanian berarti menaklukan ketakutan. ”
—Bung Hatta
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file baka-0.4.3.tar.gz
.
File metadata
- Download URL: baka-0.4.3.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30a7b278491c72b852e17648e2cbcfcf3bbf61c6e5936141c4ae1340fd419ed6 |
|
MD5 | ce21347cab94a32243abdfe12b6d2bcf |
|
BLAKE2b-256 | d3873435bf31da9df3033baa3ce649c23cb6ece91917854450fe86d18764f71d |
File details
Details for the file baka-0.4.3-py2.py3-none-any.whl
.
File metadata
- Download URL: baka-0.4.3-py2.py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91e6d3034a44e326a09cec7944a1b18cdb1630b0e560c85268aba530d975a8d3 |
|
MD5 | b36152286552eadac9f5adf6d8264f77 |
|
BLAKE2b-256 | 2cb46c2d74e9ed47463694fbe72b61358135c0535b41e97974581d851cccc77f |