An application for sending emails with remote content to arbitrary recipients. Utilizes the Amazon Web Service's Simple Email Service.
- Python 3.8+
- python-ldap build prerequisites
- via Homebrew:
brew install openldap
- via Homebrew:
- pip
- node
- gulp-cli
-
Create a new virtual environment and
cdto it (replaceENVbelow with the path to the directory you're installing your virtual environment in):python3 -m venv ENV cd ENV -
Clone the repo to a subdirectory
src:git clone [email protected]:UCF/PostMaster.git src -
Activate the virtual environment:
source bin/activate -
cdto the newsrcdirectory and install requirements:cd src pip install -r requirements.txtNOTE: if
pip installreturns a block of error text includingfatal error: 'sasl.h' file not foundupon installingpython-ldap, do the following:-
In requirements.txt, comment out the
python-ldaprequirement. -
Re-run
pip install -r requirements.txt. It should complete successfully. -
Run the following, replacing "VERSION" with the version number specified for the
python-ldappackage in requirements.txt:pip install python-ldap==VERSION \ --global-option=build_ext \ --global-option="-I$(xcrun --show-sdk-path)/usr/include/sasl" -
Un-comment the
python-ldaprequirement in requirements.txt and save the file.
-
-
Create a local settings file:
cp settings_local.template.py settings_local.py -
Configure
settings_local.pyas necessary for your environment:- When developing locally, set
LOCAL_DEBUGtoTrueto ensure static files are properly served up.
- When developing locally, set
-
Run the deployment command:
python manage.py deployThis command runs migrations and any other general setup steps.
-
Set the default value for
manager_recipient.disablein yourdefaultdatabase toFalse(https://code.djangoproject.com/ticket/470) -
Production only: Schedule management commands to run on regular intervals via automation/cron:
- Schedule the
mailer-processmanagement command to run based on thePROCESSING_INTERVAL_DURATIONsetting - Schedule the
recipient-importersmanagement command to run based on the availability of their external data sources
- Schedule the
-
Optional: Create new Setting objects, which are used for setting global value across the application (start server > log in > Settings > Add New):
office_hours_contact_info: displays next to the office hours section on the home page when logged inafter_hours_contact_info: displays next to the after hours section on the home page when logged in
-
If you haven't yet already, follow the Installation steps above to install and set up the project on your development environment.
-
From the root directory of the repo, create a new
gulp-config.json:cp gulp-config.template.json gulp-config.jsonand update settings in
gulp-config.jsonas desired. Settingsynctotruewill enable automatic browser refreshing when changes to files are made whilegulp watchis running (see below). -
Install required npm packages:
npm install -
Use gulp to process and minify source scss and js files in
src/scssandsrc/js:- Run everything:
gulp default - Watch changes, with optional browser reloading:
gulp watch
gulp will save processed files to
static. Files instaticshould be committed with git, but should never be modified directly. - Run everything:
- Be sure the
TEST_EMAIL_RECIPIENT,TEST_EMAIL_SOURCE_HTML_URI, andTEXT_EMAIL_SOURCE_TEXT_URIvariables are set appropriately - Be sure the application's database credentials have CREATE DATABASE privileges. This is needed because separate test databases are created during the testing process.
- Be sure the application can connect out to Amazon Web Services.
- From the command line, run
python manage.py test managerin the project's root directory.
- To v3.0.0
- If you have an existing virtual environment created using python 2.7, delete this environment -
rm -rf virtualenv-directory/- and run through the installation instructions above.
- If you have an existing virtual environment created using python 2.7, delete this environment -
- To v2.0.0
- Ensure virtual environment is using python 2.7+
- Pull down 2.0.0 code
pip install -r requirementsto upgrade django.- It may be necessary to reactivate the virtual environment:
source ../bin/activate - Compare
settings_local.pywithsettings_local.template.pyand make appropriate change. - Fake the initial migrations:
python manage.py migrate --fake-initial - Migrate any other changes in 2.0.0:
python manage.py migrate
- To v1.0.27
- Modify
manager_previewinstance.requested_startto have the following defintion:DATETIME NOT NULL - Modify
manager_instance.requested_startto have the following defintion:DATETIME NOT NULL
- Modify
- To v1.0.21
- Remove
manager_instance.in_progresscolumn - Create
manager_instance.requested_startcolumn with the following definition:TIME NOT NULL AFTER sent_html - Run the following SQL query:
UPDATE manager_instance JOIN manager_email ON manager_instance.email_id = manager_email.id SET manager_instance.requested_start = manager_email.send_time - Remove
manager_instance.sentcolumn - Create
manager_instance.successcolumn with the followign definition:TINYINT(1) NULL DEFAULT NULL AFTER end - Run the following SQL query:
UPDATE manager_instance SET success = 1; - Remove
manager_instancerecipientdetails.exception_typecolumn - Modify
manager_instancerecipientdetails.whento the following definitionDATETIME NULL DEFAULT NULL - Run
python manage.py syncdbto create themanager_previewinstancetable
- Remove
- To v1.0.11
- Rename
manager_email.source_uricolumn tomanager_email.source_html_uri - Create
manager_email.source_text_uricolumn with the following definition:VARCHAR(200) NULL DEFAULT NULL AFTER source_html_uri - Rename
TEST_EMAIL_SOURCE_URItoTEST_EMAIL_SOURCE_HTML_URIin settings_local.py - Add
TEST_EMAIL_SOURCE_TEXT_URIsetting to settings_local.py (see settings_local.template.py)
- Rename