yeet is a simple Python framework
Project description
yeet
quickstart
Run app
import os
from controllers import HomeController, ArticlesController
from examples.constants import INIT_QUERIES, DB_SETTINGS
from python_yeet.app import Yeet
from python_yeet.db import Database
app = Yeet(name=os.path.basename(os.getcwd()))
app.add_route(r'^articles/$', ArticlesController(methods=['GET', 'POST']))
app.add_route(r'^.*$', HomeController)
db = Database(db_settings=DB_SETTINGS,
init_queries=INIT_QUERIES)
app.run()
Create model example
import datetime
from python_yeet.orm import BaseModel, BaseManager
class Article(BaseModel):
table_name = "articles"
manager_class = BaseManager
id: int
title: str
text: str
author: int
created_at: datetime.datetime
Create controller example
from examples.models.article import Article
from python_yeet.controllers import BaseController
class ArticlesController(BaseController):
@staticmethod
def _get_articles():
articles = Article.objects.select("id", "title")
return articles
def get(self, path):
return self.render_template('articles.html', articles=self._get_articles())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_yeet-1.0.1.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for python_yeet-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 514ddeebcca047e40a9f56698786385413bb97293364e88c9cc54414d5330f65 |
|
MD5 | 070e61f5fe6316c3da9144bab0a11718 |
|
BLAKE2b-256 | a8af820f950fb85089cfa57bbcc628dc4ffc1bf2a5b798a9464e487be6a7efbf |