-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix a test error that program crash when ./static doesn't exists
- Loading branch information
Showing
3 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pathlib import Path | ||
|
||
from loguru import logger | ||
|
||
from app.config import config, environment | ||
|
||
static_dir = None | ||
thumbnails_dir = None | ||
deleted_dir = None | ||
|
||
|
||
def init(): | ||
global static_dir, thumbnails_dir, deleted_dir | ||
static_dir = Path(config.static_file.path) | ||
thumbnails_dir = static_dir / "thumbnails" | ||
deleted_dir = static_dir / "_deleted" | ||
|
||
if not static_dir.is_dir(): | ||
static_dir.mkdir(parents=True) | ||
logger.warning(f"static_dir {static_dir} not found, created.") | ||
if not thumbnails_dir.is_dir(): | ||
thumbnails_dir.mkdir(parents=True) | ||
logger.warning(f"thumbnails_dir {thumbnails_dir} not found, created.") | ||
if not deleted_dir.is_dir(): | ||
deleted_dir.mkdir(parents=True) | ||
logger.warning(f"deleted_dir {deleted_dir} not found, created.") | ||
|
||
|
||
if config.static_file.enable or environment.local_indexing: | ||
init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters