diff --git a/alembic.ini b/alembic.ini index ff732de..39f8791 100644 --- a/alembic.ini +++ b/alembic.ini @@ -52,7 +52,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne # are written from script.py.mako # output_encoding = utf-8 -sqlalchemy.url = driver://user:pass@localhost/dbname +sqlalchemy.url = mysql+pymysql://root:123456@47.96.135.132:3306/monitoring [post_write_hooks] diff --git a/alembic/env.py b/alembic/env.py index edeff1d..c01b755 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -1,10 +1,12 @@ +import os +import sys from logging.config import fileConfig - +from config.database import DatabaseModel from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context - +sys.path.append(os.path.dirname(os.path.dirname(__file__))) # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config @@ -18,7 +20,7 @@ if config.config_file_name is not None: # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata -target_metadata = None +target_metadata = DatabaseModel.metadata # other values from the config, defined by the needs of env.py, # can be acquired: diff --git a/logs/automation_info.log b/logs/automation_info.log index f4d3737..942484c 100644 --- a/logs/automation_info.log +++ b/logs/automation_info.log @@ -300,3 +300,21 @@ 2022-05-29 09:52:07 | MainThread:8661964288 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000 2022-05-29 09:52:07 | MainThread:8661964288 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs 2022-05-29 09:52:07 | MainThread:8661964288 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc +2022-05-29 11:13:54 | MainThread:8595076608 | :__init__:16 - INFO - start the automation service development environment +2022-05-29 11:13:54 | MainThread:8595076608 | :__init__:22 - INFO - loading environment configuration file +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:15 - INFO - loading application configuration +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:16 - INFO - create FastApi app object +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:25 - INFO - Adding a New route success +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:26 - INFO - Start registering middleware +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000 +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:15 - INFO - loading application configuration +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:16 - INFO - create FastApi app object +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:25 - INFO - Adding a New route success +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:26 - INFO - Start registering middleware +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:36 - INFO - Application started successfully:CORSMiddleware +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:37 - INFO - Server address http://192.168.1.107:8000 +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:38 - INFO - Api doc address http://192.168.1.107:8000/docs +2022-05-29 11:13:54 | MainThread:8595076608 | create_app:app:39 - INFO - Api redoc address http://192.168.1.107:8000/redoc