feat: initial code, as generated by Rattail Demo site
https://demo.rattailproject.org/generated-projects/new/wutta
This commit is contained in:
commit
9f17ac40d0
22 changed files with 345 additions and 0 deletions
6
wuttademo/__init__.py
Normal file
6
wuttademo/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo package root
|
||||
"""
|
||||
|
||||
from ._version import __version__
|
6
wuttademo/_version.py
Normal file
6
wuttademo/_version.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
|
||||
from importlib.metadata import version
|
||||
|
||||
|
||||
__version__ = version('Wutta-Demo')
|
30
wuttademo/commands.py
Normal file
30
wuttademo/commands.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo commands
|
||||
"""
|
||||
|
||||
import typer
|
||||
|
||||
from wuttjamaican.cli import make_typer
|
||||
|
||||
|
||||
wuttademo_typer = make_typer(
|
||||
name='wuttademo',
|
||||
help="Wutta Demo -- "
|
||||
)
|
||||
|
||||
|
||||
@wuttademo_typer.command()
|
||||
def install(
|
||||
ctx: typer.Context,
|
||||
):
|
||||
"""
|
||||
Install the Wutta Demo app
|
||||
"""
|
||||
config = ctx.parent.wutta_config
|
||||
app = config.get_app()
|
||||
install = app.get_install_handler(pkg_name='wuttademo',
|
||||
app_title="Wutta Demo",
|
||||
pypi_name='Wutta-Demo',
|
||||
egg_name='Wutta_Demo')
|
||||
install.run()
|
29
wuttademo/config.py
Normal file
29
wuttademo/config.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo config extensions
|
||||
"""
|
||||
|
||||
from wuttjamaican.conf import WuttaConfigExtension
|
||||
|
||||
|
||||
class WuttaDemoConfig(WuttaConfigExtension):
|
||||
"""
|
||||
Config extension for Wutta Demo
|
||||
"""
|
||||
key = 'wuttademo'
|
||||
|
||||
def configure(self, config):
|
||||
|
||||
# app info
|
||||
config.setdefault(f'{config.appname}.app_title', "Wutta Demo")
|
||||
config.setdefault(f'{config.appname}.app_dist', "Wutta-Demo")
|
||||
|
||||
# app model
|
||||
config.setdefault(f'{config.appname}.model_spec', 'wuttademo.db.model')
|
||||
|
||||
# web app menu
|
||||
config.setdefault(f'{config.appname}.web.menus.handler_spec',
|
||||
'wuttademo.web.menus:WuttaDemoMenuHandler')
|
||||
|
||||
# web app libcache
|
||||
#config.setdefault('tailbone.static_libcache.module', 'wuttademo.web.static')
|
0
wuttademo/db/__init__.py
Normal file
0
wuttademo/db/__init__.py
Normal file
Binary file not shown.
|
@ -0,0 +1,26 @@
|
|||
"""add wuttademo branch
|
||||
|
||||
Revision ID: b41448a639e6
|
||||
Revises: ebd75b9feaa7
|
||||
Create Date: 2024-11-24 13:35:51.509742
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'b41448a639e6'
|
||||
down_revision: Union[str, None] = 'ebd75b9feaa7'
|
||||
branch_labels: Union[str, Sequence[str], None] = ('wuttademo',)
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
pass
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
9
wuttademo/db/model/__init__.py
Normal file
9
wuttademo/db/model/__init__.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo data models
|
||||
"""
|
||||
|
||||
# bring in all of wutta
|
||||
from wuttjamaican.db.model import *
|
||||
|
||||
# TODO: import other/custom models here...
|
0
wuttademo/web/__init__.py
Normal file
0
wuttademo/web/__init__.py
Normal file
28
wuttademo/web/app.py
Normal file
28
wuttademo/web/app.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo web app
|
||||
"""
|
||||
|
||||
from wuttaweb import app as base
|
||||
|
||||
|
||||
def main(global_config, **settings):
|
||||
"""
|
||||
This function returns a Pyramid WSGI application.
|
||||
"""
|
||||
# prefer Wutta Demo templates over wuttaweb
|
||||
settings.setdefault('mako.directories', [
|
||||
'wuttademo.web:templates',
|
||||
'wuttaweb:templates',
|
||||
])
|
||||
|
||||
# make config objects
|
||||
wutta_config = base.make_wutta_config(settings)
|
||||
pyramid_config = base.make_pyramid_config(settings)
|
||||
|
||||
# bring in the rest of Wutta Demo
|
||||
pyramid_config.include('wuttademo.web.static')
|
||||
pyramid_config.include('wuttademo.web.subscribers')
|
||||
pyramid_config.include('wuttademo.web.views')
|
||||
|
||||
return pyramid_config.make_wsgi_app()
|
26
wuttademo/web/menus.py
Normal file
26
wuttademo/web/menus.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo Menu
|
||||
"""
|
||||
|
||||
from wuttaweb import menus as base
|
||||
|
||||
|
||||
class WuttaDemoMenuHandler(base.MenuHandler):
|
||||
"""
|
||||
Wutta Demo menu handler
|
||||
"""
|
||||
|
||||
def make_menus(self, request, **kwargs):
|
||||
|
||||
# TODO: override this if you need custom menus...
|
||||
|
||||
# menus = [
|
||||
# self.make_products_menu(request),
|
||||
# self.make_admin_menu(request),
|
||||
# ]
|
||||
|
||||
# ...but for now this uses default menus
|
||||
menus = super().make_menus(request, **kwargs)
|
||||
|
||||
return menus
|
22
wuttademo/web/static/__init__.py
Normal file
22
wuttademo/web/static/__init__.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Static assets
|
||||
"""
|
||||
|
||||
# from fanstatic import Library, Resource
|
||||
|
||||
|
||||
# # libcache
|
||||
# libcache = Library('wuttademo_libcache', 'libcache')
|
||||
# bb_vue_js = Resource(libcache, 'vue.esm-browser-3.3.11.prod.js')
|
||||
# bb_oruga_js = Resource(libcache, 'oruga-0.8.10.js')
|
||||
# bb_oruga_bulma_js = Resource(libcache, 'oruga-bulma-0.3.0.js')
|
||||
# bb_oruga_bulma_css = Resource(libcache, 'oruga-bulma-0.3.0.css')
|
||||
# bb_fontawesome_svg_core_js = Resource(libcache, 'fontawesome-svg-core-6.5.2.js')
|
||||
# bb_free_solid_svg_icons_js = Resource(libcache, 'free-solid-svg-icons-6.5.2.js')
|
||||
# bb_vue_fontawesome_js = Resource(libcache, 'vue-fontawesome-3.0.6.index.es.js')
|
||||
|
||||
|
||||
def includeme(config):
|
||||
config.include('wuttaweb.static')
|
||||
config.add_static_view('wuttademo', 'wuttademo.web:static', cache_max_age=3600)
|
2
wuttademo/web/static/libcache/README
Normal file
2
wuttademo/web/static/libcache/README
Normal file
|
@ -0,0 +1,2 @@
|
|||
Place files in this folder, which correspond to the Resource()
|
||||
definitions found in `wuttademo/web/static/__init__.py`
|
16
wuttademo/web/subscribers.py
Normal file
16
wuttademo/web/subscribers.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Pyramid event subscribers
|
||||
"""
|
||||
|
||||
import wuttademo
|
||||
|
||||
|
||||
def add_wuttademo_to_context(event):
|
||||
renderer_globals = event
|
||||
renderer_globals['wuttademo'] = wuttademo
|
||||
|
||||
|
||||
def includeme(config):
|
||||
config.include('wuttaweb.subscribers')
|
||||
config.add_subscriber(add_wuttademo_to_context, 'pyramid.events.BeforeRender')
|
17
wuttademo/web/templates/base_meta.mako
Normal file
17
wuttademo/web/templates/base_meta.mako
Normal file
|
@ -0,0 +1,17 @@
|
|||
## -*- coding: utf-8; mode: html; -*-
|
||||
<%inherit file="wuttaweb:templates/base_meta.mako" />
|
||||
|
||||
## TODO: you can override parent template as needed below, or you
|
||||
## can simply delete this file if no customizations are needed
|
||||
|
||||
<%def name="favicon()">
|
||||
${parent.favicon()}
|
||||
</%def>
|
||||
|
||||
<%def name="header_logo()">
|
||||
${parent.header_logo()}
|
||||
</%def>
|
||||
|
||||
<%def name="footer()">
|
||||
${parent.footer()}
|
||||
</%def>
|
13
wuttademo/web/views/__init__.py
Normal file
13
wuttademo/web/views/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Wutta Demo Views
|
||||
"""
|
||||
|
||||
|
||||
def includeme(config):
|
||||
|
||||
# core views for wuttaweb
|
||||
config.include('wuttaweb.views.essential')
|
||||
|
||||
# TODO: include your own views here
|
||||
#config.include('wuttademo.web.views.widgets')
|
Loading…
Add table
Add a link
Reference in a new issue