问题:vuejs使用history模式时,刷新页面报404错误
解决:修改nginx配置文件
方法:
location / {
try_files $uri $uri/ /index.html;
}
问题:vuejs使用history模式时,刷新页面报404错误
解决:修改nginx配置文件
方法:
location / {
try_files $uri $uri/ /index.html;
}
问题:如何使用python对接cas统一认证系统,实现用户登录?
解决:使用模块python-cas
方法:
from cas import CASClient
cas_client = CASClient(
version=3,
service_url='http://xx.com/login?next=%2Fprofile',
server_url='http://sso.xx.xx.cn/cas/'
)
@router.get("/", name="测试cas")
async def index():
return RedirectResponse('/login')
问题:python使用threading实现线程时,如何调用异步函数?
解决:使用asyncio.run
方法:
async def import_users(db, temp_name):
# 我的处理方法
pass
lock = threading.Lock()
def thread_target():
with lock:
asyncio.run(import_users(db, name))
threads = [threading.Thread(target=thread_target, args=(db, temp.name)) for _ in range(10)]
for thread in threads:
thread.start()
for thread in threads:
thread.join()
问题shell脚本如何遍历文件夹下所有文件?
方法:
dir="./sql_to_hdfs_init"
for file in `ls $dir/*`
do
echo $file # 输出 ./sql_to_hdfs_init/a.sh
if test -f $file;then # 相当于 if [ -f $file ];then
echo "执行:$file"
fi
done