Compare commits
No commits in common. "9d33377ac12120a5c8825bffd8d1044e1eaa998c" and "4f5f12473d7c1cf544449d9a484be9a26ecd6299" have entirely different histories.
9d33377ac1
...
4f5f12473d
@ -1,3 +0,0 @@
|
|||||||
DJANGO_SECRET_KEY=
|
|
||||||
DJANGO_ENV=prod
|
|
||||||
DJANGO_HOSTS=localhost,127.0.0.1
|
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
/db.sqlite3
|
db.sqlite3
|
||||||
/.env
|
|
87
README.md
87
README.md
@ -1,87 +0,0 @@
|
|||||||
# Time Dispatcher
|
|
||||||
|
|
||||||
### Table of contents
|
|
||||||
<!-- TOC -->
|
|
||||||
* [Prerequisites](#prerequisites)
|
|
||||||
* [Installation](#installation)
|
|
||||||
* [Run the app](#run-the-app)
|
|
||||||
* [Production](#production)
|
|
||||||
* [Development](#development)
|
|
||||||
* [Updating](#updating)
|
|
||||||
<!-- TOC -->
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Time Dispatcher** is a QoL tool to help you track, analyze and allocate your time spent on various projects.
|
|
||||||
Here is a list of the main features available :
|
|
||||||
- Import tasks, projects and time imputations from CSV (compatible with [Super Productivity](https://github.com/johannesjo/super-productivity))
|
|
||||||
- Create parents to group multiple projects
|
|
||||||
- Track your clock-ins / -outs and/or remote work
|
|
||||||
- Mark each parent as either productive or not, i.e. whether its projects take a share of the "clocked" time
|
|
||||||
- Automatically compute the time that should be reported as spent on each productive parent (for example to input in SageX)
|
|
||||||
- View your monthly working times in a nice table or in a summarized form on the dashboard
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Python 3+
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
1. Clone the repository
|
|
||||||
```shell
|
|
||||||
git clone https://git.kb28.ch/HEL/TimeDispatcher.git
|
|
||||||
```
|
|
||||||
2. Go inside the project directory
|
|
||||||
```shell
|
|
||||||
cd TimeDispatcher/
|
|
||||||
```
|
|
||||||
3. Install the Python requirements
|
|
||||||
```shell
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
4. Apply the database migrations
|
|
||||||
```shell
|
|
||||||
python manage.py migrate
|
|
||||||
```
|
|
||||||
5. Set the appropriate settings in the `.env` file:
|
|
||||||
1. Copy `.env.template` to `.env`
|
|
||||||
```shell
|
|
||||||
cp .env.template .env
|
|
||||||
```
|
|
||||||
2. Fill in the settings
|
|
||||||
- `DJANGO_SECRET_KEY`: The secret key used by Django.
|
|
||||||
This is a long random string.
|
|
||||||
For example, it can be generated using Python with
|
|
||||||
```python
|
|
||||||
import secrets
|
|
||||||
secrets.token_urlsafe(64)
|
|
||||||
```
|
|
||||||
- `DJANGO_ENV`: Current environment, either `prod` or `dev`
|
|
||||||
- `DJANGO_HOSTS`: Comma-separated list of allowed hosts used by Django
|
|
||||||
|
|
||||||
## Run the app
|
|
||||||
### Production
|
|
||||||
1. Start the Uvicorn server
|
|
||||||
```shell
|
|
||||||
python main.py
|
|
||||||
```
|
|
||||||
2. Open [the app](http://localhost:8000/) in your browser
|
|
||||||
|
|
||||||
### Development
|
|
||||||
1. Start the Django server
|
|
||||||
```shell
|
|
||||||
python manage.py runserver
|
|
||||||
```
|
|
||||||
2. Open [the app](http://localhost:8000/) in your browser
|
|
||||||
|
|
||||||
## Updating
|
|
||||||
(Before updating to a new version, it is recommended to back up the database file, i.e. `db.sqlite3`)
|
|
||||||
|
|
||||||
To update to a new version:
|
|
||||||
1. Download the new sources
|
|
||||||
- from the [release page](https://git.kb28.ch/HEL/TimeDispatcher/releases)
|
|
||||||
- or pull the new version with git
|
|
||||||
2. Run the database migrations:
|
|
||||||
```shell
|
|
||||||
python manage.py migrate
|
|
||||||
```
|
|
@ -9,28 +9,25 @@ https://docs.djangoproject.com/en/5.1/topics/settings/
|
|||||||
For the full list of settings and their values, see
|
For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/5.1/ref/settings/
|
https://docs.djangoproject.com/en/5.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from pathlib import Path
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
APP_VERSION = "0.1.0"
|
APP_VERSION = "0.0.1"
|
||||||
|
|
||||||
load_dotenv(BASE_DIR / ".env")
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]
|
SECRET_KEY = 'django-insecure-^*x5i_#=$9kuj6k^v0cy5dqefmzo%j*i&0w93i%!zmgsa_z)2z'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = os.environ.get("DJANGO_ENV", "dev").lower() != "prod"
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = list(map(lambda h: h.strip(), os.environ.get("DJANGO_HOSTS", "localhost,127.0.0.1").split(",")))
|
ALLOWED_HOSTS = ["localhost", "192.168.2.68"]
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
@ -60,7 +57,8 @@ ROOT_URLCONF = 'TimeDispatcher.urls'
|
|||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [BASE_DIR / 'templates'],
|
'DIRS': [BASE_DIR / 'templates']
|
||||||
|
,
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
@ -113,7 +111,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
|
|
||||||
LANGUAGE_CODE = 'en-us'
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
TIME_ZONE = 'Europe/Zurich'
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
@ -123,12 +121,7 @@ USE_TZ = True
|
|||||||
# Static files (CSS, JavaScript, Images)
|
# Static files (CSS, JavaScript, Images)
|
||||||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||||||
|
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
|
||||||
BASE_DIR / "dispatcher" / "static"
|
|
||||||
]
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_URL = 'static/'
|
||||||
_STATIC_ROOT = BASE_DIR / "dispatcher" / "static"
|
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||||||
|
@ -14,10 +14,9 @@ Including another URLconf
|
|||||||
1. Import the include() function: from django.urls import include, path
|
1. Import the include() function: from django.urls import include, path
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.urls import path, register_converter, re_path
|
from django.contrib import admin
|
||||||
from django.views.static import serve
|
from django.urls import path, register_converter
|
||||||
|
|
||||||
from TimeDispatcher import settings
|
|
||||||
from TimeDispatcher.converters import DateConverter, YearMonthConverter
|
from TimeDispatcher.converters import DateConverter, YearMonthConverter
|
||||||
from dispatcher import views
|
from dispatcher import views
|
||||||
|
|
||||||
@ -42,6 +41,3 @@ urlpatterns = [
|
|||||||
path("clockings/<date:date>/", views.set_clocking, name="set_clocking"),
|
path("clockings/<date:date>/", views.set_clocking, name="set_clocking"),
|
||||||
path("sagex/<int:id>/<year_month:month>/", views.set_real_sagex, name="set_real_sagex"),
|
path("sagex/<int:id>/<year_month:month>/", views.set_real_sagex, name="set_real_sagex"),
|
||||||
]
|
]
|
||||||
|
|
||||||
if not settings.DEBUG:
|
|
||||||
urlpatterns.append(re_path(r"^static/(?P<path>.*)$", serve, {"document_root": settings._STATIC_ROOT}))
|
|
@ -1,9 +1,8 @@
|
|||||||
from TimeDispatcher.settings import APP_VERSION, DEBUG
|
from TimeDispatcher.settings import APP_VERSION
|
||||||
|
|
||||||
|
|
||||||
def version(request):
|
def version(request):
|
||||||
return {
|
return {
|
||||||
"debug": DEBUG,
|
|
||||||
"version": APP_VERSION
|
"version": APP_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,12 +77,6 @@ footer .sep {
|
|||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer .debug {
|
|
||||||
margin-right: auto;
|
|
||||||
font-style: italic;
|
|
||||||
color: #ffb33d;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
main {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
.wrapper {
|
|
||||||
margin: auto;
|
|
||||||
max-width: 25em;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.desc {
|
|
||||||
line-height: 1.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.url {
|
|
||||||
font-family: monospace;
|
|
||||||
background-color: rgba(255, 255, 255, 0.11);
|
|
||||||
padding: 0.1em 0.4em;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
16
main.py
16
main.py
@ -1,16 +0,0 @@
|
|||||||
import uvicorn
|
|
||||||
|
|
||||||
from TimeDispatcher.asgi import application
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
uvicorn.run(
|
|
||||||
application,
|
|
||||||
host="127.0.0.1",
|
|
||||||
port=8000,
|
|
||||||
workers=1
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -1,4 +1,2 @@
|
|||||||
Django~=5.1.5
|
Django~=5.1.5
|
||||||
djangorestframework~=3.15.2
|
djangorestframework~=3.15.2
|
||||||
python-dotenv~=1.0.1
|
|
||||||
uvicorn~=0.34.0
|
|
@ -1,13 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% block title %}404 Not Found{% endblock %}
|
|
||||||
{% block head %}
|
|
||||||
<link rel="stylesheet" href="{% static "error.css" %}">
|
|
||||||
{% endblock %}
|
|
||||||
{% block footer %}{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<div class="wrapper">
|
|
||||||
<h1 class="title">Page not found</h1>
|
|
||||||
<p class="desc">Oops, page <span class="url">{{ request.path }}</span> could not be found. Go back to <a href="{% url "dashboard" %}">Dashboard</a></p>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@ -22,7 +22,6 @@
|
|||||||
{% block main %}{% endblock %}
|
{% block main %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
{% if debug %}<span class="debug">Debug</span>{% endif %}
|
|
||||||
<span><i>Time Dispatcher v{{ version }}</i></span>
|
<span><i>Time Dispatcher v{{ version }}</i></span>
|
||||||
<span class="sep"></span>
|
<span class="sep"></span>
|
||||||
<span><a href="https://git.kb28.ch/HEL/TimeDispatcher" target="_blank">Gitea</a></span>
|
<span><a href="https://git.kb28.ch/HEL/TimeDispatcher" target="_blank">Gitea</a></span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user