- Change directory to the
backend
folder by running commandcd backend
. - Create a virtul environment for python by run command
python -m venv {{name of venv here}}
. - Install all the required packages by running command
pip install -r requirements.txt
. - Run the command
pip install -e .
to install the backend folder as a package. - Run the command
python app.py
to start the backend server.
- Change directory to the
frontend
folder by running commandcd frontend
. - Install all the required packages by running command
npm install
. - Run the command
npm run dev
to start the frontend server in development mode ornpm run preview
for production mode.
- Flask: Backend framework to develop API
- APIFlask: A simple wrapper of Flask with additional features like Marshmellow, OpenAPI, etc.
- Sqlalchemy: ORM to interact with database
- SQLite: A single file database
- Whoosh: Full text search engine
- Flask-Migrate: To manage migration of database
- flask-jwt-extended: To manage JWT token for authentication
- Sveltekit: Frontend framework to develop website
- svelte-carousel: A carousel library for svelte / sveletekit
- sveltekit-flash-message: A flash message library for svelte / sveltekit
- Flask come with it's own shell to interact with the application. To start the shell, run the command
flask shell
in the terminal. - You can register your own shell command inside the
make_shell_context
function in theapp.py
file.
- Whenever you making change about the
models.py
, you are necessary to run the commandflask db migrate -m {{migrate message}}
to generate the migration file and then run the commandflask db upgrade
to apply the migration to the database. - Think of flask migrate as a version control for database.
- A tricky approach to delete all data but keep the model defined is by running the combination of commands
flask db downgrade base
followed byflask db upgrade
.
- #d09fdc light purple
- #FFB6C1 light pink
- #AEE0FF baby blue
-
How to turn Flask SQLAlchemy query results into JSON for an API?
-
Real Python Data Management With Python, SQLite, and SQLAlchemy
-
Handle image between flask to frontend by encode image into base64
-
Example application based on the tutorial "Flask Mega Tutorial Series"