No Description

Sam Newbold 88d8a034f4 fixing CSRF_COOKIE_PATH and updating README ... 2 years ago
.builds 3ef779269d 22.12 - only test the modules that are available 2 years ago
cherrypy-mount 3ef779269d 22.12 - only test the modules that are available 2 years ago
django-apps 88d8a034f4 fixing CSRF_COOKIE_PATH and updating README ... 2 years ago
dockerfiles 695f184155 functional-enough flask version 2 years ago
falcon-addroute 9ab669ef8c update helloworld-django for Django 3.2 4 years ago
flask-blueprints c6303fe404 flask-blueprints supports idtrust-flask-peewee 2 years ago
flask-dispatcher f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-cherrypy f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-cherrypy-falcon f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-cherrypy-flask f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-cherrypy-morepath f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-django 9ab669ef8c update helloworld-django for Django 3.2 4 years ago
helloworld-falcon 9ab669ef8c update helloworld-django for Django 3.2 4 years ago
helloworld-falcon-cherrypy 9ab669ef8c update helloworld-django for Django 3.2 4 years ago
helloworld-falcon-flask 9ab669ef8c update helloworld-django for Django 3.2 4 years ago
helloworld-falcon-morepath 9ab669ef8c update helloworld-django for Django 3.2 4 years ago
helloworld-flask f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-flask-cherrypy f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-flask-falcon f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-flask-morepath f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-morepath f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-morepath-cherrypy f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-morepath-falcon f81bac3028 updating and refactoring framework dependencies 4 years ago
helloworld-morepath-flask f81bac3028 updating and refactoring framework dependencies 4 years ago
idtrust-common 8b26b43e58 renaming separating idtrust-db-peewee from idtrust-common 2 years ago
idtrust-db-peewee 3ef779269d 22.12 - only test the modules that are available 2 years ago
idtrust-django ab95d6e78e temporary home for peewee dependancy 2 years ago
idtrust-flask-peewee 3ef779269d 22.12 - only test the modules that are available 2 years ago
morepath-mount f81bac3028 updating and refactoring framework dependencies 4 years ago
requirements 5c37f32f06 file to test built packages before distribution 2 years ago
src aaf202144d removing legacy omnibus package 4 years ago
tests 3ef779269d 22.12 - only test the modules that are available 2 years ago
.gitignore 3ac532e198 require "run" command to run the development server 5 years ago
LICENSE.txt 0e18d41e2c License with AGPLv3 6 years ago
README.md 88d8a034f4 fixing CSRF_COOKIE_PATH and updating README ... 2 years ago
docker-compose.yaml 1d46ae00fb converting Django templates to Jinja2 and moving them to idtrust-common 4 years ago
finitelycomputable_microsites_setup.py 29bf7f58e2 23.1 version bumps for January 2023 2 years ago
setup.sh 4a56209a9a fixes for deploying 22.11 2 years ago
tox.ini f977841596 upgrade to Django 4.1 and other version bumps 2 years ago

README.md

Environment Variables

The following environment variables are utilized by these microsites:

DJANGO_SECRET_KEY

Django will not run without this value. This is generated for you in django-admin startproject, but to serve its purpose it needs to remain secret, so you can't host a publically accessible site and leave this value in publically accessible version control before. So I took the same approach as djangopackages.org (https://github.com/djangopackages/djangopackages) and made it an environment variable after rotating the original key, before publishing the repo which had the original key in its history. You can use the same function that Django uses by running in a python shell from django.core.management.utils import get_random_secret_key get_random_secret_key() or, you can use a password manager or some other password generator.

DJANGO_SETTINGS_MODULE

Django will not run without this value. Use DJANGO_SETTINGS_MODULE=finitelycomputable.django_apps.settings.dev to develop locally. To deploy publically you will need to (at a minimum) list your hostname in ALLOWED_HOSTS and set the SECURE* settings based upon whether it will be served using SSL.

BASE_PATH

This value gives the root url of the identification of trust microsite. If it is not set then it defaults to identification_of_trust/. you can use BASE_PATH= to run it without any path prefixed, and you can run two separate servers on the same host (likely running different versions or different configurations) by giving each a different values for this environemnt variable.

MICROSITES_VERSION_PATH and MICROSITES_VERSION_TEXT

In developing software there is a recurrent problem of making some change to the implementation and needing to validate that that change did not modify the behavior, but if it does not modify the behavior, then it is hard to be certain that the changed implementation was actually what you were testing. This lets you specify some additional information at runtime to help in these sorts of situations. It also lets you display which version and configuration is running, if you so choose.

Installing base packages Install finitelycomputable-django-apps and finitelycomputable-idtrust-django into a virtual environment. This installs the whole Django Project into the virtual environment, and as a result the following commands can be run from anywhere.

To create an empty database when first running the site or when starting a server in a new directory, run manage.py migrate. (Since the SQLite database is placed in the working directory, you can have multiple installations with distinct databases using a single virtual environment and different working directories.)

Installing extras and running servers The following pip install arguments permit you to run an HTTP server on port 9000 with the corresponding commands:

  • finitelycomputable-django-apps: finitelycomputable-django-apps runserver 9000 (Django dev server)
  • finitelycomputable-django-apps[cherrypy] : finitelycomputable-django-apps-cherry 9000 (cheroot using CherryPy) (note that cheroot is a dependency of cherrypy, so the above pip install also permits the below usage)
  • finitelycomputable-django-apps[cheroot] : cheroot --bind 0.0.0.0:9000 finitelycomputable.django\_apps.wsgi (cheroot alone)
  • finitelycomputable-django-apps[gunicorn] : `gunicorn -b 0.0.0.0:9000 finitelycomputable.django_apps.wsgi
  • finitelycomputable-django-apps[bjoern] : finitelycomputable-django-apps-bjoern 9000
  • finitelycomputable-django-apps[waitress] : waitress-serve --port=9000 finitelycomputable.django_apps.wsgi:application

finitelycomputable-django-apps-cherry and finitelycomputable-django-apps-bjoern are scripts that are part of the the finitelycomputable-django-apps package because cherrypy and bjoern take their configuration as arguments in a Python function call, while the cheroot and gunicorn packages each provide a short executable script of the same name to pass arguments on the command line. (For example you can run cat $(which gunicorn) to view the one for gunicorn.

Packaging

individual packages have symlinks to a project-wide dist directory that is not part of the repo, this enables you to have working copies / worktrees that cannot be used to make distributions (e.g. to ensure that all needed files are version-controlled).

  1. You will want to install the distribution requirements in a virtualenv: pip install -U requirements/dist.txt
  2. setup.sh clean --all
  3. setup.sh sdist bdist\_wheel
  4. check-wheel-contents dist/\*.whl
  5. twine check dist/\*
  6. twine upload dist/\* -- you will need to have your own PyPi account for this and to have given the packages a unique name, or the upload will be rejected for you not having write permission for the finitelycomputabe-* packages.