This is a time clock app developed using Flask. The software can handle multiple projects users have to join, user auths, and advanced payment contracts. This software was later made private and expanded upon as contracted by a client for Chester Hill Solutions. The version of this code here is not the most updated one but will be the most updated publically available version.
This is a web app made for internal use by various political campaigns around the Greater Toronto Area to manage volunteer shifts, hours, and honourarium. This project is led by Saihaan Syed and maintained by him and Shakib Ahmed. We used Flask to develop the the apps backend, Flask-SQLAlchemy as the ORM tool, and Jinja2 for the HTML. The app is deployed onto a private linode linux nginx server with gunicorn as the WSGI, and the MySQL database is on private linode MYSQL server.
- Saihaan Syed @Sai-Sy
- Shakib Ahmed @sshakibbb
Yet to established
This is a flask app ran on a private server
1. snake_case for spaces in EVERYTHIING not camelCase or kebab-case
2. UNLESS it's a class name, then use PascalCase
3. Python type hinting is not very pythonic and adds more boiler plate code clutter, but it make working with heavily attributed objects much easier. USE THEM!
Always .strip() any inputted strings
Production Notes:
/paymentwebapp/production_notes
View section: Production Prep
- In class
DevConfig
, update path for .env file - Ensure Git ignores local changes to the config file using the following command:
git update-index --assume-unchanged <path>
where<path>
represents the path to config.py
restart nginx: sudo systemctl restart nginx
restart gunicorn: sudo supervisorctl reload
nginx config: sudo nano /etc/nginx/sites-enabled/paymentwebapp
gunicorn config: sudo nano /etc/supervisor/conf.d/paymentwebapp.conf
start venv: ~paymentwebapp$ sourve venv/bin/activate
nginx logs: sudo tail -n 5 -f /var/log/nginx/access.log
gunicorn and app logs: sudo tail -n 5 -f /var/log/paymentwebapp/paymentwebapp.err.log
- Wipe Database using:
mycursor.execute(f'DROP DATABASE {name};')
mycursor.execute(f'CREATE DATABASE {name};')
- Then run the app
- Then create the database by running
database_create_all_script()
- CD into payment web app
- Bash:
export FLASK_APP=website
- CMD:
set FLASK_APP=website
flask db init
flask db migrate -m 'Message'
flask db upgrade
https://dlukes.github.io/flask-wsgi-url-prefix.html
pip install dotenv
pip install flask
pip install flask-wtf
pip install Flask-Migrate
pip install flask_login
pip install sqlalchemy