Time tracking you can host anywhere, built on Django. Full export support in multiple formats and easily extensible.
djangodockerhandcodedpythonself-hostedtime-trackingtimetracker
1import os
2
3
4# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
5
6BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
7
8
9# Application definition
10
11INSTALLED_APPS = [
12 "client",
13 "conf",
14 "core",
15 "api",
16 "sockets",
17 "registration",
18 "widget_tweaks",
19 "django_filters",
20 "rest_framework",
21 "rest_framework.authtoken",
22 "channels",
23 "django.contrib.admin",
24 "django.contrib.auth",
25 "django.contrib.contenttypes",
26 "django.contrib.sessions",
27 "django.contrib.messages",
28 "django.contrib.staticfiles",
29 "django.contrib.sites",
30]
31
32SITE_ID = 1
33
34MIDDLEWARE = [
35 "django.middleware.security.SecurityMiddleware",
36 "whitenoise.middleware.WhiteNoiseMiddleware",
37 "django.contrib.sessions.middleware.SessionMiddleware",
38 "django.middleware.common.CommonMiddleware",
39 "django.middleware.csrf.CsrfViewMiddleware",
40 "django.contrib.auth.middleware.AuthenticationMiddleware",
41 "django.contrib.messages.middleware.MessageMiddleware",
42 "django.middleware.clickjacking.XFrameOptionsMiddleware",
43 "conf.middleware.site.SiteMiddleware",
44 "conf.middleware.i18n.I18NMiddleware",
45]
46
47ROOT_URLCONF = "timestrap.urls"
48
49TEMPLATES = [
50 {
51 "BACKEND": "django.template.backends.django.DjangoTemplates",
52 "DIRS": [os.path.join(BASE_DIR, "timestrap/templates")],
53 "APP_DIRS": True,
54 "OPTIONS": {
55 "context_processors": [
56 "django.template.context_processors.debug",
57 "django.template.context_processors.request",
58 "django.contrib.auth.context_processors.auth",
59 "django.contrib.messages.context_processors.messages",
60 "timestrap.context_processors.template_settings",
61 ]
62 },
63 }
64]
65
66WSGI_APPLICATION = "timestrap.wsgi.application"
67
68ASGI_APPLICATION = "timestrap.routing.application"
69
70
71# Authentication
72# https://docs.djangoproject.com/en/2.0/topics/auth/default/
73
74AUTHENTICATION_BACKENDS = ["conf.backends.auth.SitePermissionBackend"]
75
76LOGIN_REDIRECT_URL = "/timesheet/"
77
78LOGIN_URL = "/login/"
79
80LOGOUT_REDIRECT_URL = "/login/"
81
82
83# Internationalization
84# https://docs.djangoproject.com/en/2.0/topics/i18n/
85
86LANGUAGE_CODE = "en"
87
88TIME_ZONE = "America/New_York"
89
90USE_I18N = True
91
92USE_L10N = True
93
94USE_TZ = True
95
96
97# Email settings
98# https://docs.djangoproject.com/en/2.0/topics/email/
99
100EMAIL_BACKEND = "conf.backends.mail.EmailBackend"
101
102EMAIL_ENABLED = True
103
104
105# Static files (CSS, JavaScript, Images)
106# https://docs.djangoproject.com/en/2.0/howto/static-files/
107
108STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
109
110STATIC_URL = "/static/"
111STATIC_ROOT = os.path.join(BASE_DIR, "static")
112
113
114# Rest framework
115# http://www.django-rest-framework.org/
116
117REST_FRAMEWORK = {
118 "DEFAULT_PERMISSION_CLASSES": ["api.permissions.TimestrapDjangoModelPermissions"],
119 "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination", # noqa: E501
120 "PAGE_SIZE": 100,
121 "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
122 "UNICODE_JSON": False,
123 "DEFAULT_AUTHENTICATION_CLASSES": [
124 "rest_framework.authentication.BasicAuthentication",
125 "rest_framework.authentication.SessionAuthentication",
126 "rest_framework.authentication.TokenAuthentication",
127 ],
128}