2023-03-14 01:27:22 +00:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
from utils.const import PROJECT_ROOT
|
|
|
|
|
|
|
|
try:
|
|
|
|
import uvloop
|
|
|
|
|
|
|
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
|
|
|
except ImportError:
|
|
|
|
uvloop = None
|
|
|
|
|
|
|
|
|
|
|
|
def run():
|
|
|
|
from core.application import Application
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
load_dotenv()
|
|
|
|
Application.build().launch()
|
2022-09-08 01:08:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2023-08-02 12:11:35 +00:00
|
|
|
from gram_core.builtins.reloader import Reloader
|
2023-03-14 01:27:22 +00:00
|
|
|
from core.config import config
|
|
|
|
|
|
|
|
if config.auto_reload: # 是否启动重载器
|
|
|
|
reload_config = config.reload
|
|
|
|
|
|
|
|
Reloader(
|
|
|
|
run,
|
|
|
|
reload_delay=reload_config.delay,
|
|
|
|
reload_dirs=list(set(reload_config.dirs + [PROJECT_ROOT])),
|
|
|
|
reload_includes=reload_config.include,
|
|
|
|
reload_excludes=reload_config.exclude,
|
|
|
|
).run()
|
|
|
|
else:
|
|
|
|
run()
|
2022-09-08 01:08:37 +00:00
|
|
|
|
|
|
|
|
2022-10-10 11:07:28 +00:00
|
|
|
if __name__ == "__main__":
|
2022-09-08 01:08:37 +00:00
|
|
|
main()
|