- Create a virtual environment for the app's dependencies.
- With conda, do
conda create --name <name>
and activate the environment withconda activate <name>
.
- With conda, do
- Install the requirements outlined in
requirements.txt
.- Do
pip3 install -r requirements.txt
.
- Do
- Also install
black
, a Python formatter.- Do
conda install -c conda-forge black=21.7b0
(it will take a while).
- Do
- Edit
config.py
to hard-code config variables. Copy the hard-coded values from Heroku (under Settings > Reveal Config Vars). DO NOT PUSH THE EDITEDconfig.py
!
For non-minor changes:
- Make a new dev branch.
- Make code changes on this branch. Test your changes (on desktop & mobile view) locally and with our auto-enabled review apps (a review app is created when you make a commit to your opened PR).
- If edits were made to
.py
files, doblack .
in the main directory to format the Python code.- Your commits must pass our automatic
black
formatting checks (done for PRs).
- Your commits must pass our automatic
- Open a pull request to merge the dev branch into main. In your PR's body, describe the PR's goals, overview of changes made (with images), how you tested these changes, and future work/potential issues.
- Request a code review (required to complete PR).
- Don't forget to pull changes from main into dev before merging PR.
- If you haven't already, follow the steps above to install dependencies and create a config file.
- Start the Flask server:
python _exec_server.py <port_num>
. - Navigate to
localhost:<port_num>
in your browser.
- After editing a JS or CSS file, up the version number of the file. This ensures the browser downloads the newest version of the file (and doesn't used the cached version).
- e.g. For
app.x.y.js
, the version number isx.y
. Changex
tox+1
(andy
to0
) for major changes, ory
toy+1
for minor changes.
- e.g. For
- Install the MongoDB Compass Desktop app for easier visual interaction.
- In the app, enter the connection string for either the production or staging app.
- Connection string is found in Heroku Config Vars.
- Use the staging DB for development!
- Pushes to main are auto-deployed to the production app. DO NOT push to main unless an urgent fix is necessary. Always develop on another branch.
- To deploy to staging app, you can manually deploy a specific branch in Heroku.
- When you open a PR and make a commit, a review app (with url
tigersnatch-pr-xx.herokuapp.com
wherexx
is the PR number) is automatically created and will automatically deploy from your PR's commits.
- If needed, first manually fill a course section using the Admin panel and then subscribe to that section.
- Be sure to visit the section's course page before doing this step to force a data update for that course.
- Run
python send_notifs.py
(locally) orheroku run python src/send_notifs.py -a <app_name>
(on a specific Heroku app).
- Do
heroku logs --tail -a <app_name>
. - Use Papertrail in Heroku (stores more logs, and logs are searchable)
- Connect to https://vpn.princeton.edu using GlobalProtect VPN.
- Navigate to https://api-store.princeton.edu/store/.
- Login with TigerSnatch credentials for access to MobileApp API.
-
Write down a title for your product update, the date it was deployed, and any short tags to describe this update (e.g. What type of update is it - new feature, bug fix, feature enhancement? On which page is this feature located? How important is this update for your users - high, medium, low?)
-
Open
RELEASE_NOTES.md
andrelease_notes_metadata.json
.RELEASE_NOTES.md
is the human-readable version of our release notes in the Github Repo. This file contains the "body" of each release note, written in markdown.release_notes_metadata.json
stores the metadata for each release note: the title, date, and tags. In both files, release notes are organized in reverse chronological order (i.e. release notes should be in the same order in both files!)- In
release_notes_metadata.json
, follow the existing format to add metadata about your new note, i.e. your note's metadata is contained in an object within an ordered (reverse chron.) list:{ "title": [title], "date": [MM / DD / YY], "tags": { [tag type]: [tag value], ... } }
- NOTE: Each note's metadata must include a title, the date, and 1+ tags.
- NOTE: Tags can be of any type/value. If you want to use a new type, make sure this type is in the
if
block and has been assigned its own badge color inabout.html
(or else the tag won't be rendered):{% if "<tag type>" in note["tags"] %} <span class="badge rounded-pill" [color]>{{ note["tags"]["<tag type>"] }}</span> {% endif %}
- In
RELEASE_NOTES.md
, follow the existing format to add the body of your new release note in the appropriate order (reverse chron.), i.e.<!-- NOTE --> Title - MM / DD / YY <!-- BODY --> Body of note, written in markdown. To add images, use HTML: <img src="static/release_notes_pics/image_file" width="100%"/>
- NOTE: Any images for release notes should be saved in
static/release_notes_pics
folder. - NOTE: The
<!-- NOTE -->
and<!-- BODY -->
delimiters (in that order) must be included for each note. Otherwise, all notes may not render.
- NOTE: Any images for release notes should be saved in
- In
-
Double-check that you correctly formatted your release note and its metadata. Double-check that the Release Notes section is properly rendered on the About page. If you do not correctly carry out step 2 above, all release notes may fail to display on the About page. Push your changes to the TigerSnatch repo.
- Note that anything written above the first note in
RELEASE_NOTES.md
will not appear on the About page. To see howRELEASE_NOTES.md
andrelease_notes_metadata.json
are parsed to construct the Release Notes section on the About page, check outget_release_notes()
inapp_helper.py
.
- In
app.x.y.js
, search fordoneKeyTutorial
:
var doneKeyTutorial = "completed3";
var doneKeyBanner = "completed5";
- To force the Dashboard tutorial, change
doneKeyTutorial
to something other than its current value (e.g. increment the number). - To force the alert banner, change
doneKeyBanner
to something other than its current value (e.g. increment the number).
- Follow the steps in the "To edit JS/CSS files" section above.
Things for Shannon to Remember
- Data on course page is read from DB. If it has been more than 5 mins since course page was last visited, then API is queried and this course's data is updated in DB. Notifs script directly queries API for new enrollment/cap and checks if spots are available; does not update DB.