-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathconfig.py.example
114 lines (90 loc) · 3.1 KB
/
config.py.example
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import os
import pathlib
from fastapi_mail import ConnectionConfig
from pydantic import BaseSettings
from starlette.templating import Jinja2Templates
class Settings(BaseSettings):
app_name: str = "PyLander"
bot_api: str = "BOT_API"
webhook_url: str = "WEBHOOK_URL"
class Config:
env_file = ".env"
# GENERAL
DOMAIN = 'Our-Domain'
# DATABASE
DEVELOPMENT_DATABASE_STRING = "sqlite:///./dev.db"
# Set the following True if working on PSQL environment or set False otherwise
PSQL_ENVIRONMENT = False
# MEDIA
MEDIA_DIRECTORY = 'media'
PICTURE_EXTENSION = '.png'
AVATAR_SIZE = (120, 120)
# DEFAULT WEBSITE LANGUAGE
WEBSITE_LANGUAGE = "en"
# API-KEYS
# Get a free API KEY for Astronomy feature @ www.weatherapi.com/signup.aspx
ASTRONOMY_API_KEY = os.getenv('ASTRONOMY_API_KEY')
WEATHER_API_KEY = os.getenv('WEATHER_API_KEY')
# https://developers.google.com/calendar/quickstart/python -
# follow instracions and make an env variable with the path to the file.
CLIENT_SECRET_FILE = os.environ.get('CLIENT_SECRET')
# EXPORT
ICAL_VERSION = '2.0'
PRODUCT_ID = '-//Our product id//'
# EMAIL
email_conf = ConnectionConfig(
MAIL_USERNAME=os.getenv("MAIL_USERNAME") or "user",
MAIL_PASSWORD=os.getenv("MAIL_PASSWORD") or "password",
MAIL_FROM=os.getenv("MAIL_FROM") or "[email protected]",
MAIL_PORT=587,
MAIL_SERVER="smtp.gmail.com",
MAIL_TLS=True,
MAIL_SSL=False,
USE_CREDENTIALS=True,
)
# security
JWT_KEY = "JWT_KEY_PLACEHOLDER"
JWT_ALGORITHM = "HS256"
JWT_MIN_EXP = 60 * 24 * 7
templates = Jinja2Templates(directory=os.path.join("app", "templates"))
# application name
CALENDAR_SITE_NAME = "Calendar"
# link to the home page of the application
CALENDAR_HOME_PAGE = "calendar.pythonic.guru"
# link to the application registration page
CALENDAR_REGISTRATION_PAGE = r"calendar.pythonic.guru/registration"
# IMPORT
MAX_FILE_SIZE_MB = 5 # 5MB
VALID_FILE_EXTENSION = (".txt", ".csv", ".ics") # Can import only these files.
# Events must be within 20 years range from the current year.
EVENT_VALID_YEARS = 20
EVENT_HEADER_NOT_EMPTY = True
EVENT_HEADER_LIMIT = 50 # Max characters for event header.
EVENT_CONTENT_LIMIT = 500 # Max characters for event content.
MAX_EVENTS_START_DATE = 10 # Max Events with the same start date.
LOCATION_LIMIT = 50 # Max characters for Location.
EVENT_DURATION_LIMIT = 2 # the max duration in days for an event.
# EMOTION
"""
Emotion will appear if the level of significance is
equal to or above this constraint
"""
LEVEL_OF_SIGNIFICANCE = 0.45
# The weight of emotion based on the event title
TITLE_WEIGHTS = 0.6
# The weight of emotion based on the event content
CONTENT_WEIGHTS = 1 - TITLE_WEIGHTS
# PATHS
STATIC_ABS_PATH = os.path.abspath("static")
# LOGGER
LOG_PATH = "./var/log"
LOG_FILENAME = "calendar.log"
LOG_LEVEL = "error"
LOG_ROTATION_INTERVAL = "20 days"
LOG_RETENTION_INTERVAL = "1 month"
LOG_FORMAT = ("<level>{level: <8}</level>"
" <green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green>"
" - <cyan>{name}</cyan>:<cyan>{function}</cyan>"
" - <level>{message}</level>")
# RESOURCES
RESOURCES_DIR = pathlib.Path(__file__).parent / 'resources'