A simple and elegant Flask webapp that turns managing society fairs and events into a piece of cake!
Features:
Upcoming features:
Known events:
psycopg2
Must be run within the CUDN for the Lookup queries to work properly
master
branch.sample-env
file to .env
and set variableslbt.service
file to the relevant systemd
location*.htaccess
to your public_html
or www
folderlightbluetent/config.py
pipenv install
pipenv shell
and initialize and upgrade the database: flask db init
and flask db upgrade
run.sh
script to match directories of choice for the UNIX socketAll strings have been pulled out into a file for easy customization.
lightbluetent/translations/en/LC_MESSAGES/messages.po
pybabel compile -d translations
to compile the translationsThe existing variables are set for development. Remove them and uncomment the ones meant for production. The BigBlueButton server provided is for testing so you should request a secret from mw781.
FLASK_ENV
defaults to productionFLASK_CONFIG=production
sets which config file to loadPOSTGRES_DB
leave this field empty, it's meant for docker-compose
POSTGRES_USER=postgres
POSTGRES_HOSTNAME=postgres
POSTGRES_PASSWORD=
APPLICATION_DB=lightbluetent
SQLALCHEMY_URI="postgresql+psycopg2://user@host:port/table"
this overrides the above database variables if providedFLASK_TRUSTED_HOSTS
set this to the domain that will be usedFLASK_SECRET_KEY
secret key needed by flask; generate howeverLogs are made available in production.log
and the log level can be set accordingly in run.sh
.
Make someone an admin by running flask change-role [list of crsids] administrator
making sure to load the environment variables with pipenv shell
beforehand.
git clone https://github.com/SRCF/lightbluetent.git
cd lightbluetent
and then ./develop.sh up
lightbluetent
json
configuration for environment variables live in config
docker
contains Docker-related filestests
contains unit tests that are run with py-test
APPLICATION_CONFIG
is strictly related to the project and is used only to load a JSON configuration file with the name specified in the variable itself. By default is equal to development
and is set to testing
when running tests.FLASK_CONFIG
is used to select the Python object that contains the configuration for the Flask application (see application/app.py and application/config.py). The value of the variable is converted into the name of a class. Values are testing, development and production.FLASK_ENV
is a variable used by Flask itself, and its values are dictated by it. See the configuration documentation mentioned in the resources of the previous section../manage.py test
will run all the tests defined in tests
docker-compose
will automtically look for a .env file and load those environment variables.
pipenv install --dev
PIPENV_DONT_LOAD_ENV=1 pipenv shell
to spawn a shell with the dependencies installeddocker-compose -p development -f docker/development.yml up -d
to build and run the Flask container and the PostgreSQL container, attach the -d
flag optionally to run the containers as daemons in the backgrounddocker-compose -p development -f docker/development.yml down
to tear down the containers./develop.sh
automates much of the above and belowDB data is preserved in a docker volume. To remove the volume, docker volume ls
and then use the relevant command to delete the volume. This wipes your local dev DB. The next time the container starts up, it will generate an empty database called lightbluetent
.
flask db init
to fill the lightbluetent
database with our schemaflask db migrate -m "your message"
and flask db upgrade
to complete a database migration, do this every time you change the DB structureNote: make sure to spawn a shell with the right env vars before running these commands
Project structure and base code based on this tutorial