common.title

Docs
Quantum Circuit
TYTAN CLOUD

QUANTUM GAMING


Desktop RAG

Overview
Terms of service

Privacy policy

Contact
Research

Sign in
Sign up
common.title

Deploying python flask on amazon linux for quantum computing applications.

Yuichiro Minato

2021/07/12 13:25

We are getting more and more requests to make quantum computers into applications. There are many ways to create a production environment, but first I'd like to follow up with a sample python+flask environment.

By using flask, we can connect the front-end and the back-end in a reasonable and fast way in the quantum and machine learning industry, where it is usual to use python on the back-end to create models. Here are some examples

1、Start up a linux server

2、Install pip.

3、Install flask from pip

4、Write flask

5、Start up a web server

6、Run the production version

yum install python-pip

pip3 install flask

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
return 'Hello world'

if __name__ == '__main__':
app.run(debug=False, host='0.0.0.0', port=80)

reference(japanese lang) : https://qiita.com/tomboyboy/items/122dfdb41188176e45b5

If you don't specify the host and port, you won't be able to see it from the outside.

The data to be pulled out and the appearance of the data can be changed depending on the URL called routing, so we will design this to create the application.

In the above example, a simple web server is launched. For production use, we will launch a production web server such as apache or nginx.

reference(japanese lang) : https://qiita.com/yoshizaki_91/items/3cd785b4a670deec0685

Personally, I prefer nginx, so the deployment method is a little different from the above.

To finish it as a web app, you can now send the server-side data to the front web app, but the receiving side handles the data by javascript and decides the design by css.

There are several frameworks available these days, so by making good use of css frameworks such as bootstrap, you can efficiently implement for PC and smartphones.

Front-end implementations of machine learning and quantum algorithms are similar, so I hope they can be commonized and implemented efficiently for business use.

Permanent start-up is

export FLASK_APP=/home/sample.py

nohup flask run –host=’0.0.0.0′ –port=5000 >/home/log/sample_suc.log 2>/home/sumple_err.log &

When you stop.

ps -fA | grep python

kill ****

reference : https://kita-note.com/flask-always-run-and-stop

© 2025, blueqat Inc. All rights reserved