BUG: 修复库导入错误
- 包内使用相对导入 - 包外使用绝对导入
This commit is contained in:
parent
d163726756
commit
b5bee828ca
11
main.py
11
main.py
@ -1,11 +1,11 @@
|
||||
from flask import Flask, render_template, redirect, url_for
|
||||
from loguru import logger
|
||||
|
||||
import const
|
||||
import models
|
||||
import tools
|
||||
from config import Config
|
||||
from generator import Generator
|
||||
from src import const
|
||||
from src import models
|
||||
from src import tools
|
||||
from src.config import Config
|
||||
from src.generator import Generator
|
||||
|
||||
app = Flask(__name__)
|
||||
logger.add("endofyear.log")
|
||||
@ -41,7 +41,6 @@ def painting():
|
||||
logger.info(f"Sentiment Post: {generator.sentiment_post()}")
|
||||
logger.info(f"Long Post: {generator.long_post()}")
|
||||
logger.info(f"Short Post: {generator.short_post()}")
|
||||
logger.info(f"Custom: {custom}")
|
||||
|
||||
# 服务模式
|
||||
if config.web_status == const.SITE_SERVICE_STATIC:
|
||||
|
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
@ -5,7 +5,7 @@ from loguru import logger
|
||||
from lunardate import LunarDate
|
||||
from snownlp import SnowNLP
|
||||
|
||||
import const
|
||||
from . import const
|
||||
|
||||
|
||||
# 计算文本内容情感分数
|
||||
|
@ -1,12 +1,11 @@
|
||||
import configparser
|
||||
import json
|
||||
import os
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from loguru import logger
|
||||
|
||||
import const
|
||||
from src.tools import check_website_status
|
||||
from . import const
|
||||
from .tools import check_website_status
|
||||
|
||||
|
||||
class Config:
|
||||
|
@ -2,8 +2,8 @@ from functools import lru_cache
|
||||
|
||||
from loguru import logger
|
||||
|
||||
import models
|
||||
import scraper
|
||||
from . import models
|
||||
from . import scraper
|
||||
|
||||
|
||||
@lru_cache(maxsize=None)
|
||||
|
@ -4,9 +4,9 @@ from collections import Counter
|
||||
import feedparser
|
||||
from loguru import logger
|
||||
|
||||
import analyzer
|
||||
import const
|
||||
import tools
|
||||
from . import analyzer
|
||||
from . import const
|
||||
from . import tools
|
||||
|
||||
|
||||
class Blog:
|
||||
|
@ -7,7 +7,7 @@ from bs4 import BeautifulSoup
|
||||
from dateutil.parser import parse
|
||||
from loguru import logger
|
||||
|
||||
import const
|
||||
from . import const
|
||||
|
||||
|
||||
def check_website_status(url):
|
||||
|
@ -79,7 +79,7 @@
|
||||
</div>
|
||||
<div class="container animate__animated animate__fadeIn animate__slow" id="tab5">
|
||||
<div class="tab5-box">
|
||||
<p class="animate__animated animate__fadeInDown animate__delay-1s">在{{ special_post.date }}那天,你写下了</p>
|
||||
<p class="animate__animated animate__fadeInDown animate__delay-1s">在{{ special_post.date }}那天,写下了</p>
|
||||
<p class="animate__animated animate__fadeInDown animate__delay-2s">{{ special_post.title }}</p>
|
||||
<p class="animate__animated animate__fadeInDown animate__delay-3s">{{ special_post.content[:50] }}<small>……</small>
|
||||
</p>
|
||||
|
Loading…
Reference in New Issue
Block a user