(For myself) AWS_Flask_3 (Install / Run Flask on AWS)

item

  1. Install Flask on AWS
  2. Actually move it

1. Install Flask on AWS

--Assuming that Python has already been installed last time

Terminal


#To home directory
$$ cd

#Create a Python virtual environment(myenv can be another name)
$$ python3 -m venv myenv

#Enable the Python virtual environment
$$ source myenv/bin/activate
#In the place of the environment name on the left(myenv)Is displayed, it is successful

#Keep pip up to date
$$ pip install --upgrade pip

#Install Flask
$$ pip install flask

#Check if there is a module in pip properly
$$ pip freeze

2. Actually move it

Terminal


#Create a py file, this time it will run on Apache/var/www/Make in html
$$ vi /var/www/html/test.py

test.py


#I say it many times'i'Input mode, when input is finished'esc'、':wq'End of saving with
from flask import Flask
app = Flask(__name__)
 
@app.route('/')
def hello():
    return 'Hello World!'
 
if __name__ == '__main__':
#Flask is hosted by'0.0.0.0'It seems that it will not work otherwise, this area is essential
    app.run(host='0.0.0.0')

Terminal


#Run in browser!
$$ python3 /var/www/html/test.py

# http://Public IP address set in AWS:Hello with connection to 5000!Should be doing

#End of Python virtual environment
$$ deactivate

3. At the end

――FLask worked for the time being! ――It was a long way ――After that, if you do your best to connect to MySQL from Python --Book Chan! --Bridge too far

Recommended Posts

(For myself) AWS_Flask_3 (Install / Run Flask on AWS)
Install Docker on AWS
Run YOLO v3 on AWS v2
Run YOLO v3 on AWS
Run AWS IoT Device SDK for Python on Raspberry Pi
Install AWS SDK for PHP on AWS EC2 (PHP7.2 + Apache2.4.41 + OPCashe + Composer)
Install and run dropbox on Ubuntu 20.04
Preparing to run Flask on EC2
Run Python on Schedule on AWS Lambda
(For myself) Flask_7 (Open database from Flask)
Install confluent-kafka for Python on Ubuntu
(For myself) Flask_5 (Add to txt file)
Run TensorFlow on a GPU instance on AWS
(For myself) Flask_AWS_1 (Install PHP, MySQL, phpMyAdmin, Python in AWS virtual environment)
Install ROS and ROS module for Roomba on RaspberryPi3 and try to run it
[Python] Run Flask on Google App Engine
(For myself) Put Flask in VS Code
[Python] Run Headless Chrome on AWS Lambda
(For myself) Flask_3 (form, POST and GET)
Prepare the development environment for Python on AWS Cloud9 (pip install & time change)
Until you install Python with pythonbrew and run Flask on a WSGI server
Periodically run a python program on AWS Lambda
Install and run Python3.5 + NumPy + SciPy on Windows 10
[2020 version] How to install Python3 on AWS EC2
Run Python web apps on NGINX + NGINX Unit + Flask
A memorandum for touching python Flask on heroku
Run Flask on CentOS with python3.4, Gunicorn + Nginx.
Install Python and libraries for Python on MacOS Catalina
python [for myself]
Until you run a Flask application on Google App Engine for the time being
Notes on Flask
Jupyter on AWS
Run the flask app on Cloud9 and Apache Httpd
Install psycopg2 (pgsql library for python3) on Apple Silicon
Support for Python 2.7 runtime on AWS Lambda (as of 2020.1)
Compile and install MySQL-python for python2.7 on amazon linux
Install Docker on Arch Linux and run it remotely
Run GPU version tensorflow on AWS EC2 Spot Instances
Procedure for creating a Line Bot on AWS Lambda
[AWS EC2] How to install Maven on Amazon Linux 2
For those who can't install Python on Windows XP
(For myself) Flask_2 (list and for, extends, and a little more)