Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Add cookiecutter template project for atramhasis.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wim-De-Clercq committed Nov 30, 2021
0 parents commit 6c7ee93
Show file tree
Hide file tree
Showing 58 changed files with 37,355 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
47 changes: 47 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
=======================
atramhasis demo project
=======================

Requirements
------------

* Python 3.6+
* npm
* `cookiecutter <https://cookiecutter.readthedocs.io/en/latest/installation.html>`_

Usage
-----

#. Generate an atramhasis demo project.

.. code-block:: bash
$ cookiecutter gh:OnroerendErfgoed/atramhasis_scaffold_cookiecutter
#. Create a virtual environment and install requirements

.. code-block:: bash
# Change directory into your newly created project if not already there.
$ pip install -r requirements-dev.txt
$ pip install -e .
#. Setup database

.. code-block:: bash
$ alembic upgrade head
#. install frontend requirements

.. code-block:: bash
$ cd <package-name>/static
$ npm install
#. Run server

.. code-block:: bash
$ cd <root of repo>
$ pserve development.ini
6 changes: 6 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"repo": "atramhasis_demo",
"package": "atramhasis_demo",
"package_logger": "demo_logger",
"project": "atramhasis-demo"
}
4 changes: 4 additions & 0 deletions {{cookiecutter.repo}}/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0.0
---

- Initial version
2 changes: 2 additions & 0 deletions {{cookiecutter.repo}}/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.txt *.ini *.cfg *.rst
recursive-include {{cookiecutter.package}} *.ico *.png *.css *.gif *.jpg *.pt *.txt *.jinja2 *.js *.html *.xml
3 changes: 3 additions & 0 deletions {{cookiecutter.repo}}/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{cookiecutter.package}} README

this is just a scaffold
Empty file.
64 changes: 64 additions & 0 deletions {{cookiecutter.repo}}/alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = atramhasis:alembic

# uncomment if your project uses its own alembic
# script_location = alembic
# version_locations = %(here)s/alembic/versions atramhasis:alembic/versions

# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s

# max length of characters to apply to the
# "slug" field
#truncate_slug_length = 40

# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false

# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false

# sqlalchemy.url = sqlite:///%(here)s/atramhasis.sqlite

ini_location = %(here)s/development.ini

# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
131 changes: 131 additions & 0 deletions {{cookiecutter.repo}}/development.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###

[app:main]
use = egg:{{cookiecutter.project}}

pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
pyramid_debugtoolbar
pyramid_tm
jinja2.directories =
atramhasis:templates
jinja2.extensions =
jinja2.ext.do
jinja2.ext.with_
jinja2.filters =
label_sort = atramhasis.utils.label_sort
sqlalchemy.url = sqlite:///%(here)s/{{cookiecutter.package}}.sqlite

atramhasis.session_factory.secret = test123

skosprovider.skosregistry_location = request
skosprovider.skosregistry_factory = {{cookiecutter.package}}.skos.create_registry

# cache
cache.tree.backend = dogpile.cache.memory
cache.tree.arguments.cache_size = 5000
cache.tree.expiration_time = 7000

cache.list.backend = dogpile.cache.memory
cache.list.arguments.cache_size = 5000
cache.list.expiration_time = 7000


# Edit and uncomment to activate nl and fr language support or other languages
# you have added yourself.
# available_languages = en nl fr

# Run dojo from source (src) or distribution (dist)
# If unspecified, defaults to src.
dojo.mode = dist

jinja2.i18n.domain = atramhasis

# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 127.0.0.1 ::1

# Filesystem location to dump exports
atramhasis.dump_location = %(here)s/datadumps

# Assume an LDF server is present?
# atramhasis.ldf.enabled = True

# Location of the config file for the LDF server
# atramhasis.ldf.config_location = %(here)s

# External url of the LDF server
# atramhasis.ldf.baseurl = http://demo.atramhasis.org/ldf

# Protocol the LDF server is operating under.
# See the LDF docs for more info
# atramhasis.ldf.protocol = http

# Edit this to be a list of ids of conceptschemes. Concepts from these schemes
# will be presented on the homepage
layout.focus_conceptschemes =
STUFF
MORE_STUFF
EVEN_MORE_STUFF
THINGS

###
# wsgi server configuration
###

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###

[loggers]
keys = root, atramhasis, sqlalchemy, {{cookiecutter.package_logger}}

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_atramhasis]
level = DEBUG
handlers =
qualname = atramhasis

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither. (Recommended for production systems.)

[logger_{{cookiecutter.package_logger}}]
level = DEBUG
handlers =
qualname = {{cookiecutter.package}}

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
4 changes: 4 additions & 0 deletions {{cookiecutter.repo}}/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Runtime requirements
--requirement requirements.txt

pyramid-debugtoolbar
1 change: 1 addition & 0 deletions {{cookiecutter.repo}}/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
atramhasis
21 changes: 21 additions & 0 deletions {{cookiecutter.repo}}/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[compile_catalog]
directory = {{cookiecutter.package}}/locale
domain = atramhasis
statistics = true

[extract_messages]
add_comments = TRANSLATORS:
output_file = {{cookiecutter.package}}/locale/atramhasis.pot
width = 80
mapping_file = message-extraction.ini

[init_catalog]
domain = atramhasis
input_file = {{cookiecutter.package}}/locale/atramhasis.pot
output_dir = {{cookiecutter.package}}/locale

[update_catalog]
domain = atramhasis
input_file = {{cookiecutter.package}}/locale/atramhasis.pot
output_dir = {{cookiecutter.package}}/locale
previous = true
52 changes: 52 additions & 0 deletions {{cookiecutter.repo}}/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()

requires = [
'pyramid',
'pyramid_tm',
'SQLAlchemy',
'transaction',
'zope.sqlalchemy',
'waitress',
'skosprovider',
'skosprovider_sqlalchemy',
'pyramid_skosprovider',
'pyramid_jinja2',
'alembic',
'babel',
'colander',
'atramhasis'
]

setup(name='{{cookiecutter.project}}',
version='0.0',
description='{{cookiecutter.project}}',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
],
author='',
author_email='',
url='',
keywords='web pyramid pylons',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=requires,
test_suite="{{cookiecutter.package}}",
entry_points="""\
[paste.app_factory]
main = {{cookiecutter.package}}:main
""",
)
Loading

0 comments on commit 6c7ee93

Please sign in to comment.