One
flask blueprint for action: implement the modular routing flask
Instructions:
Create a blueprint in the routing of the newly created admin:
from flask import Blueprint admin = Blueprint('admin',__name__) @admin.route('/') def admin_home(): return 'admin_home'
Then newly registered blueprint app.py import and register the app
from flask import Flask from admin.views import admin from user.views import user app = Flask(__name__) app.register_blueprint(admin, url_prefix="/admin") app.register_blueprint(user, url_prefix="/user") @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run()
After the access port address plus / admin will then return a admin_home example: http://127.0.0.1:5000/admin/
two
condos7 installation python3
First install the dependencies
yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Create an empty folder to install python3
mkdir /usr/local/python3
cd /usr/local/python3
According to their needs and then download a different version of Python3, I downloaded the A Python 3 .7 .2
Download the installation package
wget wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
If the download is slow, you can consider downloading using the browser and use WinSCP with other software on the server reached the designated location
Then extracting archive
takes -xvJf Python 3.7.2.tar.xz
Enter Python - 3.7. 2 folder and install
cd Python-3.7.2 ./configure --prefix=/usr/local/python3 make && make install
Finally, create a soft link
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
Python3 test input on the command line
python3 -V