Notifications admin application.
This repo is a clone / modifed version of: https://github.com/alphagov/notifications-admin
- Register and manage users
- Create and manage services
- Send batch emails and SMS by uploading a CSV
- Show history of notifications
- We currently do not support sending of letters
- We currently do not receive a response if text messages were delivered or not
Brew is a package manager for OSX. The following command installs brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Languages needed
brew install node
NPM is Node's package management tool. n
is a tool for managing
different versions of Node. The following installs n
and uses the long term support (LTS)
version of Node.
npm install -g n
n lts
npm rebuild node-sass
On OS X:
- Install PyEnv with Homebrew. This will preserve your sanity.
brew install pyenv
- Install Python 3.6.9 or whatever is the latest
pyenv install 3.6.9
- If you expect no conflicts, set
3.6.9
as you default
pyenv global 3.6.9
- Ensure it installed by running
python --version
if it did not, take a look here: pyenv/pyenv#660
- Install
virtualenv
:
pip install virtualenvwrapper
- Add the following to your shell rc file. ex:
.bashrc
or.zshrc
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source ~/.pyenv/versions/3.6.9/bin/virtualenvwrapper.sh
- Restart your terminal and make your virtual environtment:
mkvirtualenv -p ~/.pyenv/versions/3.6.9/bin/python notifications-admin
- You can now return to your environment any time by entering
workon notifications-admin
- Decrypt our existing set of environment variables
aws kms decrypt --ciphertext-blob fileb://.env.enc.aws --output text --query Plaintext --region us-east-1 | base64 --decode > .env
A sane set of defaults exists in .env.example
- Install all dependencies
pip3 install -r requirements.txt
- Generate the version file ?!?
make generate-version-file
- Run the service
flask run -p 6012 --host=0.0.0.0
- To test
pip3 install -r requirements_for_test.txt
make test
If you want the front end assets to re-compile on changes, leave this running in a separate terminal from the app
npm run watch
requirements.txt
file is generated from the requirements-app.txt
in order to pin
versions of all nested dependencies. If requirements-app.txt
has been changed (or
we want to update the unpinned nested dependencies) requirements.txt
should be
regenerated with
make freeze-requirements
requirements.txt
should be committed alongside requirements-app.txt
changes.
When running locally static assets are served by Flask at http://localhost:6012/static/…
When running on preview, staging and production there’s a bit more to it:
- Wrap your template text
<h1>{{ _('Hello') }}</h1>
- For form hints
Set a variable
<div class="extra-tracking">
{% set hint_txt = _('We’ll send you a security code by text message') %}
{{ textbox(form.mobile_number, width='3-4', hint=hint_txt) }}
</div>
For forms
from flask_babel import _
Wrap your text
_('Your text here')
For JavaScript
// add your text to main_template
window.APP_PHRASES = {
now: "{{ _('Now') }}",
}
// in your JS file
let now_txt = window.polyglot.t("now");
- Extract
pybabel extract -F babel.cfg -k _l -o messages.pot .
pybabel update -i messages.pot -d app/translations
- Compile
pybabel compile -d app/translations