Home Applications flask-iris

flask-iris

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
0
0 reviews
0
Awards
186
Views
0
IPM installs
0
0
Details
Releases
Reviews
Issues
Pull requests
Articles
A quick guide / template to use Flask and IRIS side by side.

What's new in this version

Initial Release

flask-iris

A quick guide / framework to use Flask and IRIS side by side.
It follows the Official Flask Documentation and the Flask-SQLAlchemy Documentation as close as possible, so that you can easily use them to continue the developing of your application without conflicts.

Installation Guide

(Optionally) Create and activate virtual environment. The following code is an example for Windows.

 python -m venv .venv
 .venv/Scripts/activate
  1. Clone this repository

    git clone https://github.com/heloisatambara/flask-iris.git
    
  2. Make sure you’re in \flask-iris> directory on your terminal and type

    pip install -r requirements.txt
    

Usage Guide

Make sure that the instance is running.

  1. Edit the flaskr-iris/database.py file to connect the application to the instance where you want to store your models. The string has the format “iris://username:password@host:port/NAMESPACE”. Check the SQLAlchemy docs, this article, or the iris dialect docs for more details.
engine = create_engine("iris://_SYSTEM:sys@localhost:1972/SAMPLE")
  1. Create your models on flaskr-iris/models.py, according to the Flask-SQLAlchemy or SQLAlchemy Docs.

  2. Edit your templates in flaskr-iris/templates. I followed the Flask Tutorial for this one, so you can check it for more information. Flask uses the Jinja template library.

  3. Run on debug mode.

...\flask-iris> flask --app flaskr-iris run --debug

Additional Information

If you have the default configuration, you will have tables called SQLUser.post and SQLUser.user on the selected namespace, if you wish to perform any treatment with InterSystems’ products. You can find it on Studio on the User folder.

(STILL ON DEVELOPMENT) Also, you can check out step-by-step how this was developed on the Example of Flask application with SQLAlchemy IRIS article.

Feel free to contact me for any doubts!

TODO:

Add tests

Read more
Made with
Version
1.0.006 Oct, 2023
Ideas portal
https://ideas.intersystems.com/ideas/DPI-I-399
Category
Template
Works with
InterSystems IRISInterSystems IRIS Cloud SQL
First published
16 Sep, 2023