Development setup¶
Please configure your editor to respect the EditorConfig settings.
Code and build process is split between frontend and backend part. Note that the frontend must be build before the backend, as its results will be incorporated as static files into the Python package.
Frontend¶
The frontend support code is written in TypeScript and Less, and compiled and bundled using Webpack. To install the dependencies and start a development server:
% npm install # may update package-lock.json, or instead:
% npm clean-install # uses package-lock.json exactly
% npm run start
This starts a development server that watches for changes and automatically rebuilds the bundle, and instructs the browser to reload using a WebSocket connection. To build for production:
% npm run build
Backend¶
Dependencies are managed using PDM, the build process is handled by PDM-Backend.
You may want to create a virtualenv explicitly in order to install pip as well, and/or activate the virtualenv:
% pdm venv create --with-pip
% eval $(pdm venv activate)
To install dependencies, including those for development:
% pdm install --dev
Create a directory instance for your instance configuration, and edit the
configuration:
% cp -r examples instance
% $EDITOR instance/config/config.py
Do replace SECRET_KEY with a unique, random value; and customise
SQLALCHEMY_DATABASE_URI according to your environment. See SQLAlchemy
documentation for details. You may need to create a database in your database
server beforehand.
Run database migrations:
% pdm run migrate
To start the development server:
% pdm run serve
If you want to use the flask command-line tool without specifying the app
every time, you can use a .env file:
% echo FLASK_APP=schilder2000 >> .env