Skip to content

Commit

Permalink
Review cookiecutters. #876
Browse files Browse the repository at this point in the history
  • Loading branch information
goessebr committed Jul 1, 2024
1 parent 0677415 commit 9a3fadd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cookiecutters/scaffold/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"root_folder": "atramhasis_scaffold",
"python_package": "atramhasis_scaffold",
"package_logger": "scaffold_logger"
"package_logger": "atramhasis_scaffold_logger"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[app:main]
use = egg:{{ cookiecutter.python_package }}

sqlalchemy.url = sqlite:///%(here)s/atra.db
sqlalchemy.url = sqlite:///%(here)s/{{cookiecutter.python_package}}.sqlite


[server:main]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ dependencies = [

[project.optional-dependencies]
dev = [
"waitress"
"waitress",
"pyramid_debugtoolbar",
]

[project.entry-points."paste.app_factory"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import os

from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from sqlalchemy import engine_from_config

from atramhasis.data.models import Base


def main(global_config, **settings):
""" This function returns a Pyramid WSGI application."""
"""This function returns a Pyramid WSGI application."""

# Set up sqlalchemy
engine = engine_from_config(settings, "sqlalchemy.")
Base.metadata.bind = engine

# set up dump location
dump_location = settings["atramhasis.dump_location"]
if not os.path.exists(dump_location):
os.makedirs(dump_location)

with Configurator(settings=settings) as config:
config.include('atramhasis')
# set default session factory
atramhasis_session_factory = SignedCookieSessionFactory(
settings["atramhasis.session_factory.secret"]
)
config.set_session_factory(atramhasis_session_factory)

# Set up atramhasis
config.include("atramhasis")
# Set up atramhasis db
config.include('atramhasis:data.db')
config.include("atramhasis:data.db")

config.scan()
return config.make_wsgi_app()

0 comments on commit 9a3fadd

Please sign in to comment.