-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsettings.py
51 lines (40 loc) · 1.27 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
extra settings for flask api configurations
"""
import os
import shutil
from pathlib import Path
from datetime import datetime
from os.path import isdir, join as joinpath
BASE_DIR = Path(__file__).resolve().parent
UPLOADS_DIR = joinpath(BASE_DIR, "uploads")
ASSETS_DIR = joinpath(BASE_DIR, "assets")
FILTERS_DIR = joinpath(BASE_DIR, "filters")
def create_directory(folder_name):
""" Create new directory """
if not isdir(folder_name):
os.mkdir(folder_name)
def recreate_uploads_dir():
""" Recreate the entire uploads directory """
try:
shutil.rmtree(joinpath(UPLOADS_DIR)),
except Exception as error:
print(error)
create_directory("uploads")
try:
shutil.copy(
joinpath(ASSETS_DIR, "sample.jpg"),
joinpath(UPLOADS_DIR, "sample.jpg")
)
except Exception as error:
print(error)
# creating uploads directory
create_directory('uploads')
""" Json data """
title = "OpenCV Rest API with FastAPI for Face Detection and Face Filters"
api_version = "1.0.0"
base_url = "https://face-filter-api.herokuapp.com/"
documentation_url = "https://face-filter-api.herokuapp.com/docs"
current_time = datetime.utcnow()
num_of_image_on_server = len(os.listdir(UPLOADS_DIR))
MAX_CONTENT_LENGTH = 2097152