Minimalist website.
- Install Git
- Install Python 3
- Install PostgreSQL
- Install the
invoke
Python packagepip install --user invoke
- Clone this repository
git clone https://github.com/scrub/website.git && cd website
- Set up virtual environment
python3 -m venv .env
source .env/bin/activate
- Install all dependencies
inv install
- Configure environment variables
vim src/website/.env
- Launch website
inv run
(--prod
for production), orFLASK_APP=src/website/ flask run
, orpython3 src/wsgi.py
- Follow all steps in the 'Installing' section
- Install the development packages
inv install --dev
, orinv install-python-deps --dev
- When testing emails, ensure you have the default mail environment settings, then run:
inv run-debug-mail-server
- Run Flask shell
FLASK_APP=src/website/ flask shell
- Create database migration file
FLASK_APP=src/website/ flask db migrate -m "Describe change here"
- Run black linting
inv run-python-black-linter
- Run isort linting
inv run-python-isort-linter
- Run flake8 linting
inv run-python-flake8-linter
- Run mypy type checker
inv run-python-type-checker
- Run unit tests
inv run-unit-tests
- Run integration tests
inv run-integration-tests
- Run functional tests
inv run-functional-tests
Potentially useful settings for development.
.vscode/settings.json
- for general development.
{
"[python]": {
"editor.rulers": [79],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"python.pythonPath": ".env/bin/python3",
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.ignorePatterns": [
".env/*.py",
"migrations/*.py"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": ["--load-plugins", "pylint-flask"],
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"-l",
"79"
],
}
.vscode/launch.json
- for debugging.
{
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "src/wsgi.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
}
]
}